Datagridview combo box
Can the datagridview combo box allow user input?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Hirendra SisodiyaRank #258 · 9.8K reputationPosted Mar 18, 2010, 9:12 PM EDT
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