NickMalloy
Programmer
I have a windows form that has a datagrid on it. The datagrid is filled with a dataset that contains two tables with a relationship. Basically a parent child relationship. I call my datagrid datagrid1. When the datagrid loads the parent information I can select a little + next to the record that I want to show the children of that record. Once the children are showen I want to be able to select the child element and get the index of that child record. So if 3 records are shown on the datagrid and I select the second record the index would be 1. The problem is that I get the index number for what the parent record index was. How can I correct this? Here is my code for selecting the index. I know I can select the information from the child element, but I can't get the index number
Dim strEpisode As Integer
Dim iSelect As Integer
If (DataGrid1.DataMember.Length >= 25 AndAlso DataGrid1.DataMember.Substring(17, 8) = "Phase_II") Then
strMRN = DataGrid1(DataGrid1.CurrentRowIndex(), 0)
strEpisode = DataGrid1(DataGrid1.CurrentRowIndex(), 1)
strEpisode = DataGrid1(DataGrid1.CurrentRowIndex(), 1)
iSelect = 3
ElseIf (DataGrid1.DataMember.Length >= 16 AndAlso DataGrid1.DataMember.Substring(9, 7) = "Phase_I") Then
strMRN = DataGrid1(DataGrid1.CurrentRowIndex(), 0)
strEpisode = DataGrid1(DataGrid1.CurrentRowIndex(), 1)
iSelect = 2
Else
strMRN = DataGrid1(DataGrid1.CurrentRowIndex(), 0)
iSelect = 1
End If
Dim strEpisode As Integer
Dim iSelect As Integer
If (DataGrid1.DataMember.Length >= 25 AndAlso DataGrid1.DataMember.Substring(17, 8) = "Phase_II") Then
strMRN = DataGrid1(DataGrid1.CurrentRowIndex(), 0)
strEpisode = DataGrid1(DataGrid1.CurrentRowIndex(), 1)
strEpisode = DataGrid1(DataGrid1.CurrentRowIndex(), 1)
iSelect = 3
ElseIf (DataGrid1.DataMember.Length >= 16 AndAlso DataGrid1.DataMember.Substring(9, 7) = "Phase_I") Then
strMRN = DataGrid1(DataGrid1.CurrentRowIndex(), 0)
strEpisode = DataGrid1(DataGrid1.CurrentRowIndex(), 1)
iSelect = 2
Else
strMRN = DataGrid1(DataGrid1.CurrentRowIndex(), 0)
iSelect = 1
End If