DataGridView - combobox as a column
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, all I have a question about using DataGridView. Could you write me a code sample how to get and set SelectedItem in Combobox column in DataGridView Here is the code i use to create a new row DataGridViewCell dgvc = datagrid.Columns[0].CellTemplate; datagrid.Rows[index].Cells[0].Value = dgvc; in CellTemplate two items Fast Slow and it's not clear for me how to set 'Slow' item programmatically i've tried ((ComboBox)(datagrid.Rows[index].Cells[0].Value)).SelectedIndex = 1; ((ComboBox)(dgvr.Cells[0].Value)).SelectedIndex = 1; ((DataGridViewComboBoxCell)(datagrid.Rows[index].Cells[2].Value)).SelectedIndex = 1; but it throws exceptions What should i do?