I've just started learning vb.net and although it's awesome I've been
tearing my hair out trying to find a solution to this specific problem. I
have a form with 2 data grid views and I would like the 2nd datagrid view to
automatically be populated with relevant data when the selected row is
changed on the first datagridview.
I have created the dataset and 2 table adapters (the 2nd expecting a
parameter for the SQL Select statement). On the first datagrid I have the
following code:
Private Sub DGV1_SelectionC hanged(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles DGV1.SelectionC hanged
If Not IsDBNull(DGV1.C urrentRow.Cells (3).Value) Then
Me.Table2TableA dapter.Fill(Me. myDataSet.Table 2,
DGV1.CurrentRow .Cells(0).Value )
End If
End Sub
This is working fine - until I try and reorder DGV1 by clicking on the
column headers... then I get a NullreferenceEx ception - Object reference not
set to an instance of an object. Help!!! I haven't got much hair left to
pull out!
Thanks,
John
tearing my hair out trying to find a solution to this specific problem. I
have a form with 2 data grid views and I would like the 2nd datagrid view to
automatically be populated with relevant data when the selected row is
changed on the first datagridview.
I have created the dataset and 2 table adapters (the 2nd expecting a
parameter for the SQL Select statement). On the first datagrid I have the
following code:
Private Sub DGV1_SelectionC hanged(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles DGV1.SelectionC hanged
If Not IsDBNull(DGV1.C urrentRow.Cells (3).Value) Then
Me.Table2TableA dapter.Fill(Me. myDataSet.Table 2,
DGV1.CurrentRow .Cells(0).Value )
End If
End Sub
This is working fine - until I try and reorder DGV1 by clicking on the
column headers... then I get a NullreferenceEx ception - Object reference not
set to an instance of an object. Help!!! I haven't got much hair left to
pull out!
Thanks,
John
Comment