I have a DataGridView responsible for displaying data bits, and two of my columns allow user input using comboboxes.
The problem is that one column only needs to show the predefined values in this list, and in the other it needs to show presets and let the user enter their own values.
I accomplish this by showing an edit control for combobox with this bit of code:
Private Sub DGV_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DGV.EditingControlShowing
'todo: figure out which control is being edited (the reason or the action) and only allow the action column to allow user input
If TypeOf e.Control Is DataGridViewComboBoxEditingControl Then
Dim cb As ComboBox = e.Control
cb.DropDownStyle = ComboBoxStyle.DropDown
End If
End Sub
This allows the user to be entered into both comboboxes in the DGV, but I only want to allow data entry for one of them.
Is there a way to determine which column in DGV is created for editing, so that I do not run this code for both columns?
?