If you have ever used a DataGridView with a DataGridViewComboBox column, then you would have definitely noticed that you need multiple clicks to select an item in the combo box. This is very annoying because every time you want to select a different item from the combo box, you need at least 2-3 clicks.
Fix
Fortunately, there is a simple fix for this: set the EditMode property of the data grid view to EditOnEnter. So, when the user enters the control, the cell is automatically put in edit mode, so when you actually click on the combo box, you can see the drop down list.
A bug
That being said, there is a bug associated with this. With the EditMode property set to EditOnEnter, when you select a row by clicking on the row header, the entire row is selected, but one cell will be in edit mode. What this means is if you try to delete the row by selecting the row header, you cannot delete the row because the delete key is actually being sent to the cell being edited and not the row.
This page has more details on this bug and also a workaround.
thank u
Thanks searching for alternative approach. Made very simple
You can use this way to fix this issue:
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridView grid = (DataGridView)sender;
if (grid.Columns[e.ColumnIndex].Name == “Fidessa_Service”)
{
grid.BeginEdit(true);
((ComboBox)grid.EditingControl).DroppedDown = true;
}
}
thanks..
thanks very much.. this is very helpful..
Thanks for the tip! This was driving me nuts.
Thanks a lot it saves me a lot of time
The Leo’s solution was also grate 😉
[…] раз. Это глюк. Наиболее простой способ лечения (найден на английском сайте Codelicious) – установить свойству DataGridView EditMode значение EditOnEnter. […]
Thanks, it saved my time.
Thx!
Was starting to get quite annoied by this error or strange behaviour!
thanks man
Why doesn’t Microsoft fix this?!? Not helpful for beginners!
[…] Set EditMode property of the DataGridView to EditOnEnter: link […]