Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / February 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Davis - 25 Feb 2005 02:58 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.