I have 4 tabpages with a datagridview on them. In each datagridview is a part of a datatable displayed. On each tabpage are also labels displayed (representing 4 compartments). When a user selects a label of one of these compartments a check is made if this label matches the compartment of the selected datagridline.
The problem is that I can check which datagridviewline is selected (selectedASNline), but if I use this value it seems that this value is not the selectedrow of the datatable. How can I convert the selectedrow of the datagridview to the selectedrow on of the datatable?
Any help is appreciated, MB
Dim SelectedASNLine, i As Integer
Dim CompartmentArea As Label = sender
'Find the correct datagridview based on the name of the label (sender)
If CInt(CompartmentArea.Name.Substring(0, 1)) = 1 Then
SelectedASNLine = Me.DataGridView3.CurrentRow().Index
ElseIf CInt(CompartmentArea.Name.Substring(0, 1)) = 2 Then
SelectedASNLine = Me.DataGridView4.CurrentRow().Index
ElseIf CInt(CompartmentArea.Name.Substring(0, 1)) = 3 Then
SelectedASNLine = Me.DataGridView5.CurrentRow().Index
SelectedASNLine = Me.DataGridView6.CurrentRow().Index
'Check if the selected compartmentarea and the compartment in ASN match
If Not ds.Tables("ASNs").Rows(SelectedASNLine)("Compartment").ToString = (CompartmentArea.Name.Substring(0, 2)).ToString Then
MsgBox("This ASN line is stored in another compartment", MsgBoxStyle.Information)