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
Cor Ligthert - 25 Feb 2005 12:45 GMT
Davis,
Can you try to change this?
> Try
> blnAdd = True
[quoted text clipped - 6 lines]
> MsgBox(ex.ToString, MsgBoxStyle.Exclamation)
> End Try
In
\\\
blnAdd = True
bm.AddNew()
bm.EndCurrentEdit()
///
I hope this helps
Cor
DAVIS_HK - 28 Feb 2005 03:02 GMT
Sorry, still doesn't work...
What can I do to add new row and clear the form????
> Davis,
>
[quoted text clipped - 21 lines]
>
> Cor
Cor Ligthert - 28 Feb 2005 07:02 GMT
Davis,
Strange because I tested this one before and it did work fine for me.
Did you try it?
Cor