Insert DataGridViewComboBoxColumn() showing the DropDownList when not selected.

0
0

I have a problem with a DataGridView, i’ve made a DataGridViewComboBoxColumn to add to the grid.

If i click the column.
Cb Selected

If the column is selected it still have the DropDownlist with the arrow showing.
Cb Selected

If the column is not selected it not looks like a DropDownList to click
Cb No Focus

In my code i use something like.

Dim column As DataGridViewComboBoxColumn = New DataGridViewComboBoxColumn()
Dim cell As DataGridViewComboBoxCell = New DataGridViewComboBoxCell()
column.CellTemplate = cell
column.Items.Add("40")
column.Items.Add("70")
column.Items.Add("90")
column.Items.Add("100")
column.DropDownStyle = ComboBoxStyle.DropDownList
column.DisplayMember = "Value"
column.DefaultCellStyle.BackColor = Drawing.Color.White
column.ReadOnly = False
GridView.Columns.Add(column)

Don’t know what i’m doing wrong.
Tks in advance.

  • You must to post comments
0
0

The combobox cell editor is created only when the cell is in edit mode. If you want to render the cell in a way that looks like a combo you can do that using css or a theme mixin.

See: https://wisej.com/support/question/combobox-dropdownstyle-in-datagridview-is-not-saved

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.