Data Bound Control Problems
I fixed one problem by binding controls to a dataset and created two more.
I an setting up a binding context like this:
Me.CustDataAdapter.Fill(DsCustomer1, "Customer")
bmb = Me.BindingContext(DsCustomer1, "customer")
Then I display the records full screen with one textbox for each field of data. I have command buttons for Next, Prev, Firsrt and Last which use the bindings like this:
Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click
If bmb.Position > 0 Then
bmb.Position -= 1
End If
End Sub
Problem is, I cant update the dataset with new or changed records. After changes to the dataset I call the Update method of the CustDataAdapter, but nothing happens. If I test for dataset.HasChanges() it always comes back false.
For example, if you press the New Record button I clear the databound fields by doing this:
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
bmb.AddNew()
End Sub
Then fill in the blanks and press Save which does this:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
CustDataAdapter.Update(DsCustomer1)
End Sub
There are no errors, but the new record is not saved. If I change a value on an existing record and do the Update, the change is not saved either. Calling the AcceptChanges method before the Update does no good either.
So what am I doing wrong?