1 Attachment(s)
[RESOLVED] [2005] combobox in datagridview, single click
Hello
I have a combobox in my datagridview.
But when I want to select from one of the items I have click about 3 times to select the item itself.
Is there a way to single click on the combobox to that will make it drop down so that the user can select the item.
Many thanks,
Steve
Re: [2005] combobox in datagridview, single click
In datagrid view the combox work on the single click event. I do not what are you doing there.
Have you set the item in the datagridview combo?
Re: [2005] combobox in datagridview, single click
Hello,
I am not doing anything with the event of a cell being clicked.
I just want to select an item from the combo box. Currently it takes about 3 clicks to do this. 1 for activating the cell, 2nd for activating the combo box adn dropping it, and 3rd selecting the item.
I am wondering is there a way to cut down on the about of clicks that are needed.
Thanks,
Re: [2005] combobox in datagridview, single click
As we know that the datagridview is the parent of the cell combobox
so this will work from the parent to child
and this combination will be as
DataGridView -> DataGridViewRow -> DataGridViewcolumn
for more detail you can see the datagridview click event!
other wise it is batter to use a seperate combo for it!
Re: [2005] combobox in datagridview, single click
Try this, it works with 1 click:
vb Code:
Private Sub dgvReceiptItems_CellEnter( ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs ) _
Handles dgvReceiptItems.CellEnter
Dim dgv As DataGridView = CType(sender, DataGridView)
If dgv(e.ColumnIndex, e.RowIndex).EditType IsNot Nothing Then
If dgv(e.ColumnIndex, e.RowIndex).EditType.ToString() = "System.Windows.Forms.DataGridViewComboBoxEditingControl" Then
SendKeys.Send("{F4}")
End If
End If
End Sub
Re: [2005] combobox in datagridview, single click
There is a better way set the property EditMode to EditOnEnter
Thanks
Re: [2005] combobox in datagridview, single click
Quote:
Originally Posted by
alex30
Try this, it works with 1 click:
vb Code:
Private Sub dgvReceiptItems_CellEnter( ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs ) _
Handles dgvReceiptItems.CellEnter
Dim dgv As DataGridView = CType(sender, DataGridView)
If dgv(e.ColumnIndex, e.RowIndex).EditType IsNot Nothing Then
If dgv(e.ColumnIndex, e.RowIndex).EditType.ToString() = "System.Windows.Forms.DataGridViewComboBoxEditingControl" Then
SendKeys.Send("{F4}")
End If
End If
End Sub
This helped much !!! (even after 10 years LOL)
Quote:
Originally Posted by
steve_rm
There is a better way set the property EditMode to EditOnEnter
Thanks
This way with EditOnEnter works as well, but text in other cells can be easily changed after accidental key press.