Hi Guys!
Well I have a DataGrid and each time any row is added or removed this method is called and it saves the data but when I want to delete the last row from this gridview it gives me NullReferenceException Error!
I searched everywhere but nothing I could find!
The only thing I noticed that I should put NEW keyword in this method but where and for which class I really dont know....This error was new for me, so thats why I send you this message!
This is my code:
Private Sub SaveData()
Dim TableAdapters As New DatabaseDataSetTableAdapters.PassnegerNamesTableAdapter
Me.TextBox1.Text = Me.RouteComboBox.SelectedValue
Me.TextBox2.Text = Me.FlightComboBox.SelectedValue
Me.TextBox3.Text = Me.TimeTextBox.Text
Me.TextBox4.Text = Me.DateTimePicker.Value
Try
Me.Validate()
Me.PassnegerNamesBindingSource.EndEdit()
TableAdapters.Update(Me.DatabaseDataSet.PassnegerNames)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
I'm getting error right at this point!
Thanks
Well I have a DataGrid and each time any row is added or removed this method is called and it saves the data but when I want to delete the last row from this gridview it gives me NullReferenceException Error!
I searched everywhere but nothing I could find!
The only thing I noticed that I should put NEW keyword in this method but where and for which class I really dont know....This error was new for me, so thats why I send you this message!
This is my code:
Private Sub SaveData()
Dim TableAdapters As New DatabaseDataSetTableAdapters.PassnegerNamesTableAdapter
Me.TextBox1.Text = Me.RouteComboBox.SelectedValue
Me.TextBox2.Text = Me.FlightComboBox.SelectedValue
Me.TextBox3.Text = Me.TimeTextBox.Text
Me.TextBox4.Text = Me.DateTimePicker.Value
Try
Me.Validate()
Me.PassnegerNamesBindingSource.EndEdit()
TableAdapters.Update(Me.DatabaseDataSet.PassnegerNames)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
I'm getting error right at this point!
Thanks
Last edited: