PC Review


Reply
Thread Tools Rate Thread

How to add new record in a form with BindingManagerBase used?

 
 
Davis
Guest
Posts: n/a
 
      25th Feb 2005
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


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      25th Feb 2005
Davis,

Can you try to change this?

> 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


In
\\\
blnAdd = True
bm.AddNew()
bm.EndCurrentEdit()
///

I hope this helps

Cor


 
Reply With Quote
 
=?Utf-8?B?REFWSVNfSEs=?=
Guest
Posts: n/a
 
      28th Feb 2005
Sorry, still doesn't work...

What can I do to add new row and clear the form????


"Cor Ligthert" wrote:

> Davis,
>
> Can you try to change this?
>
> > 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

>
> In
> \\\
> blnAdd = True
> bm.AddNew()
> bm.EndCurrentEdit()
> ///
>
> I hope this helps
>
> Cor
>
>
>

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      28th Feb 2005
Davis,

Strange because I tested this one before and it did work fine for me.

Did you try it?

Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If I open a form, add a new record, close the form (without saving or changing records) will it still save the new record? Chris K Microsoft Access Form Coding 1 5th Sep 2010 01:25 AM
BindingManagerBase Not Working =?Utf-8?B?R3JlZw==?= Microsoft ADO .NET 3 1st Jun 2004 04:36 PM
BindingManagerBase object Jesse Villani Microsoft VB .NET 4 20th Jan 2004 12:18 AM
BindingManagerBase Joe Microsoft VB .NET 4 23rd Dec 2003 07:37 PM
Help: BindingManagerBase problem Darwin S. Microsoft ADO .NET 1 18th Nov 2003 09:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:08 AM.