J
John
Hi
I have a small app with bound controls that do not seem to be copying across
the data entered into them to the underlying row for the update. This one
really has me stump even though these are very simple steps and I can't see
where I am going wrong. Any help would be appreciated.
The relevant code goes as follows;
Binding controls
Dim db As System.Windows.Forms.Binding
ds = MyDataset
db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
txtID.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
txtCompany.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
txtAddress.DataBindings.Add(db)
bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)
Adding a new record;
ds.Clients.Clear()
bmCompanyDetails.AddNew()
Some data is entered in the Company and Address bound fields by user and
Save button is pressed to save as below;
Focus()
bmCompanyDetails.EndCurrentEdit()
Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row
If (Row.RowState = DataRowState.Added) Then
' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data is
stored in datatable so update is working
daCompanies.Update(ds.Clients)
End If
The Clients table is an MS Access table with ID set to Random Auto number.
Thanks
Regards
I have a small app with bound controls that do not seem to be copying across
the data entered into them to the underlying row for the update. This one
really has me stump even though these are very simple steps and I can't see
where I am going wrong. Any help would be appreciated.
The relevant code goes as follows;
Binding controls
Dim db As System.Windows.Forms.Binding
ds = MyDataset
db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
txtID.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
txtCompany.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
txtAddress.DataBindings.Add(db)
bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)
Adding a new record;
ds.Clients.Clear()
bmCompanyDetails.AddNew()
Some data is entered in the Company and Address bound fields by user and
Save button is pressed to save as below;
Focus()
bmCompanyDetails.EndCurrentEdit()
Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row
If (Row.RowState = DataRowState.Added) Then
' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data is
stored in datatable so update is working
daCompanies.Update(ds.Clients)
End If
The Clients table is an MS Access table with ID set to Random Auto number.
Thanks
Regards