I have a question that I hope someone could help me with. My question involves winforms and the datagridview in Visual Studio 2008. I want to bind my datagridview to a collection of business objects instead of a dataset. I would like to have comboboxes in the datagridview which get its value from one of the properties in the business object. Is this possible? Can someone please provide example code or provide a web page which describes how to do this. Any help would be appreciated.
Thanks,
Greg
Here is a simple data class:
Create a form and place a DataGridView control on it, add this code:
Since you want comboboxes in your grid, you have to set
AutoGenerateColumnsto false and create them yourself, mapping each column to the property in your class through theDataPropertyNameproperty. For the combobox, you can set its ownDataSourcefor the list of drop down items.