J
John Tressle
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_SelectionChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles DGV1.SelectionChanged
If Not IsDBNull(DGV1.CurrentRow.Cells(3).Value) Then
Me.Table2TableAdapter.Fill(Me.myDataSet.Table2,
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 NullreferenceException - 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_SelectionChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles DGV1.SelectionChanged
If Not IsDBNull(DGV1.CurrentRow.Cells(3).Value) Then
Me.Table2TableAdapter.Fill(Me.myDataSet.Table2,
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 NullreferenceException - Object reference not
set to an instance of an object. Help!!! I haven't got much hair left to
pull out!
Thanks,
John