DataGridViewComboBoxColumn requires multiple clicks to select an item

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.

Advertisements

11 thoughts on “DataGridViewComboBoxColumn requires multiple clicks to select an item

  1. shamita das says:

    thank u

  2. Shaik says:

    Thanks searching for alternative approach. Made very simple

  3. leo says:

    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;
    }
    }

  4. farhad says:

    thanks very much.. this is very helpful..

  5. Seth says:

    Thanks for the tip! This was driving me nuts.

  6. Salman says:

    Thanks a lot it saves me a lot of time
    The Leo’s solution was also grate 😉

  7. […] раз. Это глюк. Наиболее простой способ лечения (найден на английском сайте Codelicious) – установить свойству DataGridView EditMode значение EditOnEnter. […]

  8. kets says:

    Thanks, it saved my time.

  9. Paul says:

    Thx!
    Was starting to get quite annoied by this error or strange behaviour!

  10. Diego says:

    thanks man

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: