si2030
asked on
Modify a datagridview combobox which is editable to not display the first item automatically..
Hi Experts,
I have a datagridviewcombobox which I have made editable.
The problem is, when I go and click on it I find it automatically populates the combobox with the first item in the drop down. See the following to see what I mean
http://www.screencast.com/users/si2030/folders/Jing/media/9c8d310d-b6c0-4e09-93b4-ecff36cae8b8
I have used the following code to make it editable. - see the code area.
I want to click on any combobox in this column and be able to type without starting with the first item in it.
I thought you might be able to use selectionStart but I dont know how to apply it - if that is the answer..
I have a datagridviewcombobox which I have made editable.
The problem is, when I go and click on it I find it automatically populates the combobox with the first item in the drop down. See the following to see what I mean
http://www.screencast.com/users/si2030/folders/Jing/media/9c8d310d-b6c0-4e09-93b4-ecff36cae8b8
I have used the following code to make it editable. - see the code area.
I want to click on any combobox in this column and be able to type without starting with the first item in it.
I thought you might be able to use selectionStart but I dont know how to apply it - if that is the answer..
Private Sub dgvCreditorInvoiceDetail_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgvCreditorInvoiceDetail.EditingControlShowing
If (TypeOf e.Control Is DataGridViewComboBoxEditingControl) Then
Dim cmb As DataGridViewComboBoxEditingControl = CType(e.Control, DataGridViewComboBoxEditingControl)
If (Not cmb Is Nothing) And (dgvCreditorInvoiceDetail.CurrentCellAddress.X = 0) Then
cmb.DropDownStyle = ComboBoxStyle.DropDown
End If
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad I could help!
jpaulino
jpaulino
ASKER
Thanks jpaulino..
SImon