Editable Combobox in Datagrid

If you're using VB 2005 then you should be using a DataGridView, not a DataGrid. If you are using a DataGridView then please be careful with your terminology in future as it makes a big difference. In a DataGridView you add a column of type DataGridViewComboBoxColumn and set its properties accordingly. Many of its properties mimic the standard ComboBox, like DataSource, DisplayMember, etc. If you want it to have a property like ComboBox.DropDownStyle then you'll have to derive your own classes from DataGridViewComboBoxColumn and DataGridViewComboBoxCell and provide that property yourself. The DataGridViewComboBoxCell hosts a DataGridViewComboBoxEditingControl object, which inherits ComboBox, so you can expose any additional members of the ComboBox class you want. Here are some links that will show you the relationship between the column, cell and editing control and how the properties of the editing control are propagated to the column:

http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx
http://www.windowsforms.net/WhidbeyFeatures/default.aspx?PageID=2&ItemID=13&Cat=Controls
 
Back
Top