I have a DataGridView
with two columns defined like:
Dim col As New DataGridViewColumn
col.DefaultCellStyle.BackColor = Color.FromArgb(&HFFAAAAAA)
col.Name = "Description"
col.MinimumWidth = 80
col.DataPropertyName = "Description"
col.ValueType = GetType(String)
col.ReadOnly = True
col.CellTemplate = New DataGridViewTextBoxCell
S0Grid.Columns.Add(col)
col = New DataGridViewColumn
col.DefaultCellStyle.BackColor = Color.FromArgb(&HFFBBBBBB)
col.Name = "Value"
col.MinimumWidth = 80
col.DataPropertyName = "Value"
col.ValueType = GetType(String)
col.CellTemplate = New DataGridViewTextBoxCell
S0Grid.Columns.Add(col)
I need that the cell in position Col=1, Row=0 is a ComboBox
and not a TextBox
. So I tried to add the following code but it does not work, the edit control remains a TextBox.
Dim cbCell As New
DataGridViewComboBoxCell
cbCell.Items.AddRange([Enum].GetNames(GetType(System.Reflection.BindingFlags)))
S0Grid(1, 0) = cbCell
Do you know how can I solve this issue?