Private Sub DataGridView1_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
Dim Combobox As ComboBox = CType(e.Control, ComboBox)
If (Combobox IsNot Nothing) Then
'Remove an existing event-handler
RemoveHandler Combobox.SelectedIndexChanged, New EventHandler(AddressOf DataGridView1_SelectionChanged)
'Add the event handler.
AddHandler Combobox.SelectedIndexChanged, New EventHandler(AddressOf DataGridView1_SelectionChanged)
End If
End Sub
Private Sub DataGridView1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim comboBox As ComboBox = CType(sender, ComboBox)
'Display selected value
MsgBox("ProgramID: " & comboBox.SelectedValue.ToString)
End Sub