Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Combobox in a DataGridView
 

Combobox in a DataGridView

I havecreated a Combobox as a cell within a DataGridView. The DataGridView is bound to a table. When I execute the program and click on the combobox dropdown, the combobox is highlighted. I need to click a second time for the dropdown list to open. How can I fix this so the dropdown list opens on the first click?

rmadler  Thursday, October 19, 2006 11:49 PM
This is what I use. May not be pretty, but it seems to work.



Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
'eliminates double click to drop combobox
Dim dgv As DataGridView = CType(sender, DataGridView)
If dgv(e.ColumnIndex, e.RowIndex).EditType.ToString() = "System.Windows.Forms.DataGridViewComboBoxEditingControl" Then
SendKeys.Send("{F4}")
End If
End Sub

Buster951  Friday, October 20, 2006 1:14 AM

Using the CellEnter event causes problems when I try to select a row or delete a row.

Is there a way to deterimine if the dropdown arrow was clicked on the combobox and then send the F4 key?

rmadler  Saturday, October 21, 2006 2:28 PM

You can use google to search for other answers

Custom Search

More Threads

• Cleaning up a datagridview in virtual mode
• Using OVER Clause in TableAdapter Configuration Wizard
• Problem with DataGridView
• DataGridView.VisibleChanged bug
• Inserting a default value into a formview
• DatagridView, setting Font for individual Cells
• [C#]datagridview copy/paste entire rows
• Storing value from my ComboBox hosted in cell in DataGridView
• insert value to all cells in column
• BUG in data grid control