AddNew dont work...(for me at least)

Hi All,

I have the following line of code on a form of mine:

Me.BindingContext(dsBookings, "Bookings.BookingDates").EndCurrentEdit()
Me.BindingContext(dsBookings, "Bookings.BookingDates").AddNew()

Now the result of the following is correct:Smile

Me.BindingContext(dsBookings, "Bookings.BookingDates").Count.ToString

but the position is still on the record it was on when the addnew button was pressedSad. Furthermore when I try to navigate to that new row I cant get to it. Has the new row not been commited to the dataset?

Please note the binding is following a relation named 'BookingDates'.

In other words, the AddNew looks like it works but I cant get to the row it added even though the count shows it has been added.

Just when I think I have understood databinding!

[960 byte] By [CodeScribler] at [2008-2-6]
# 1
How are you trying to navigate to the new row? Is the data bound to a grid and if so, how are you binding to the grid?

You may have a case of multiple CurrencyManagers with different Currency (position). In VS 2005, we auto-generate BindingSources that hide the complexity associated with CurrencyManagers and BindingContext. In general, you should be using a BindingSource rather than using BindingContext or CurrencyManager. When using a BindingSource, you generally won't run into multiple CurrencyManager issues.

Joe

JoeStegman at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 2
Thanks Joe for your comments.

First of all I will google search 'bindingsource' but if you know of a good article/tutorial on the subject that would be useful.

Secondly, I am binding to two date time pickers and using two buttons to navigate the options. These are part of a much bigger form with lots of bindings to relations. To make the binding I am using the following code:



Private Sub DatesRequired()

' Enquiry Dates

dtpArrivalDate.DataBindings.Add(New Binding("Value", dsBookings, "Bookings.BookingDates.Arrival")) ' dtpArrivalDate is a dateTimePicker

dtpDepartureDate.DataBindings.Add(New Binding("Value", dsBookings, "Bookings.BookingDates.Departure"))' dtpDepartureDate is a dateTimePicker

DateOptionPositionChanged()

End Sub

PS. I am also using VS 2003

CodeScribler at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...