Get the ID of selected ID in combobox and then show a form depending on the value of ID.
I have a DataGridView with a few columns in it and a combo box. I am using two data tables for this. dgv 1 is for the Data in the dgv and the other one is the item in the combo box. What I want to happen is when User chooses a status in the combo box, it will get the ID of the item, then If ID = 0 a form will show that the user needs to fill up.
Private Sub dgvPassed_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs)
Dim comboCell As ComboBox = CType(e.Control, ComboBox)
If (Not (comboCell) Is Nothing) Then
AddHandler comboCell.SelectedIndexChanged, AddressOf Me.comboCell_SelectedIndexChanged
End If
End Sub
Private Sub comboCell_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim cellText As String = dgvPassed.CurrentRow.Cells(7).Value.ToString
'retrieve data from database using this cellText
End Sub
I tried using this and put breakpoint in it but after running and clicking in the datagridview combobox the breakpoint didnt even trigger.