Datagridview Comboboxes

I have been searching for info about dtatgridview dropdowncomboboxes. I have found all the needed info except how to display info that is available in the dropdown. For example in a list with 5 items say Item1, Item2, Item3, Item4, and Item5 there would be a selection into the database of various members of this list. If it was a textbox column displaying them would be easy, how do I do the same with a combo box This is probably an easy question but I am stumped.

Mike



Answer this question

Datagridview Comboboxes

  • MJC2006

    hi,

    what you are looking for is called lookup using a property called "DataPropertyName"

    here its my previous post about this

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=347502&SiteID=1

    hope this helps


  • Delroy Ja.

    Populating the Combo box is not the issue, as I know how to do that. What I want is when you read the database into the datagridview the correct combobox list item is selected and shows up in the cell.
  • Leo Liu

    Thank you, that is what I was looking for. It makes me wonder why they couldn't just use the same properties as a combo box But again Thank you.
  • gon_no1

    Are you wanting to know how to populate the data items from the database into a dropdown list

    if so...

    Take a look at this reply of mine:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=549622&SiteID=1

    More specifically look at the foreach loop.

     

    if this is not what you are looking for, please let me know and if possible, could you explain it a bit more in depth

    Thanks!

     



  • Avi120

    hi,

    you are welcome, mark the answer as reply plz

    best regards


  • Datagridview Comboboxes