I have struggled with this problem for too long, and have seen all the answers on this topic, and although I have found that some of them do not seem to work for me. So, the basis of my problem is this: I have a DataGridView that will add a row to itself when another DataGridView cell is double-clicked. When this DataGridView gets the added row, it adds 2 types of columns to itself, one of them is the ComboBox , which, apparently, has a set already installed in it (just went to the ComboBox parameters inside the datagrid and filled its collection) and the column checkbox, now they both do nothing, as soon as I click on them, doble clic, a few clicks as many clicks as I want, but nothing happens. I even tried the following code.
public static void combolist(DataGridView combogrid) { var column = new DataGridViewComboBoxColumn(); DataTable data = new DataTable(); data.Columns.Add(new DataColumn("Value", typeof(string))); data.Columns.Add(new DataColumn("Description", typeof(string))); data.Rows.Add("item1"); data.Rows.Add("item2"); data.Rows.Add("item3"); column.DataSource = data; column.ValueMember = "Value"; column.DisplayMember = "Description"; combogrid.Columns.Add(column); }
and even if I can add a new column of type ComboBox to my DataGridView , it is still empty (or, it seems, since I have not seen the click to see the drop-down list). for my DataGridView gridview properties is set to:
editMode: editOnEnter, readOnly: false.
Is there something missing here? why I can’t fill out or display this ComboBox ?, plz, this problem is driving me crazy and I think this is the best site to find the answer. I would give a lot of applause ... a lot.
Well, that’s why I definitely should see the problem from a different point of view, I’m even trying to bind the ComboBox to the data source and still not show anything! Although the same data source, bound to the normal ComboBox , gets the desired result
DataGridViewComboBoxCell ComboColumn = (DataGridViewComboBoxCell)(combogrid.Rows[0].Cells[2]); ComboColumn.DataSource = class.details.GetData(); ComboColumn.DisplayMember = "name";
Is there any basic im step when working with a ComboBox inside a DataGridView ?