D
Davis
Dear Experts,
I have a problem on adding new record in a form, with btnAdd_Click function,
the record stays at current record...even with a clear form function, it
only clear the record currently staying at. Seems that the datatable in ds
doesn't go to "AddNew" mode... or I need to do anything?? (btnNavNext_Click
works fine with the BindingManagerBase)
What should I do if all controls are binded with
txtOrderID.DataBindings.Add("Text", ds, "Order.OrderID")
Please help...
Thanks!!
Davis
Dim bm As BindingManagerBase
Dim ds As New DataSet
.......
Form_OnLoad:
bm = BindingContext(ds, "Order")
.......
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Try
blnAdd = True
bm.EndCurrentEdit()
bm.AddNew()
bm.Position = ds.Tables("Order").Rows.Count -1
ClearForm() '-- Clear control values
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Exclamation)
End Try
End Sub
Private Sub btnNavNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNavNext.Click
bm.Position += 1
End Sub
I have a problem on adding new record in a form, with btnAdd_Click function,
the record stays at current record...even with a clear form function, it
only clear the record currently staying at. Seems that the datatable in ds
doesn't go to "AddNew" mode... or I need to do anything?? (btnNavNext_Click
works fine with the BindingManagerBase)
What should I do if all controls are binded with
txtOrderID.DataBindings.Add("Text", ds, "Order.OrderID")
Please help...
Thanks!!
Davis
Dim bm As BindingManagerBase
Dim ds As New DataSet
.......
Form_OnLoad:
bm = BindingContext(ds, "Order")
.......
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Try
blnAdd = True
bm.EndCurrentEdit()
bm.AddNew()
bm.Position = ds.Tables("Order").Rows.Count -1
ClearForm() '-- Clear control values
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Exclamation)
End Try
End Sub
Private Sub btnNavNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNavNext.Click
bm.Position += 1
End Sub