datagridview combo box
Can the datagridview combo box allow user input?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hirendra SisodiyaPosted Mar 19, 2010, 1:12 AM
you can do it with the help of EditingControlShowing event of datagridview
suppose that your first column is combobox of datagridview than you can use this code
Private Sub DataGridView1_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
Dim comboBoxColumn As DataGridViewComboBoxColumn = DataGridView1.Columns(0)
If (DataGridView1.CurrentCellAddress.X = comboBoxColumn.DisplayIndex) Then
Dim objCombo As ComboBox = e.Control
If (objCombo IsNot Nothing) Then
objCombo.DropDownStyle = ComboBoxStyle.DropDown
End If
End If
End Sub
thanks
'mark as answere if you like my answere