Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1008461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:46:28+00:00 2026-05-16T08:46:28+00:00

So I have a collection that I have in a listbox right now, which

  • 0

So I have a collection that I have in a listbox right now, which displays each item in the collection. I want to turn the listbox into a gridview, so I can add checkboxes and other drop downs. I am unable to find a tutorial that explains how to do this.

For the example my collection has 2 items, each item has multiple columns.

  • [0] 747 Jet
    • [0] Passenger amount: 417
    • [1] First Flight: 1967
  • [0] A380
    • [0] Passenger amount: 853
    • [1] First Flight: 2005

Right now my listbox uses this code

foreach (AMAPnr.Airplane airElement in AMAPnr.Airplanes)
{
    lstPlanes.Items.Add(
        "PassengerAmount: " + airElement.Passenger + " First Flight:" +
         airElement.FirstFlight.ToString());
}

How would i go about changing this into a gridview?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:46:28+00:00Added an answer on May 16, 2026 at 8:46 am

    Update: The OP has clarified that they chose the wrong tags and this was actually for WinForms.

    If you add a DataGridView to your form, and then put the following code in your forms codebehind, it works a treat:

    private class Airplane
    {
        public string AirplaneName { get; set; }
        public int PassengerAmt { get; set; }
        public int FirstFlight { get; set; }
    }
    
    public Form1()
    {
        InitializeComponent();
    
        var planes = new List<Airplane>();
        planes.Add(new Airplane() { AirplaneName = "747 Jet", PassengerAmt = 417, FirstFlight = 1967 });
    
        dataGridView1.DataSource = planes;
    
    }
    

    I’ve used a custom Airplane class to show this example a I don’t know precisely how your code’s structured and it was easier for me that way. You should be able to plug in your custom datatype relatively easily.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a collection that use as a cache. How can I limit the
I have a collection that contains all the items that I want to keep
I have Backbone.js collection that holds (for example) 30 items. I want to pass
Say I have a ListBox that is bound to an observable collection on my
I'm writing a Silverlight application. I want a Listbox that displays the rows vertically.
I currently have a view that contains a ListBox bound to a a collection
I have a page that has a listbox with the following item template as
Hi I want to create a looping listbox so that the last item's next
I have an ObservableCollection that I want to bind to my listbox... lbRosterList.ItemsSource =
I have a listbox which is bounded to an observable collection. The elements in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.