Why isn't dataset.HasChanges changing?

I have textboxes bound with a bindsource to a dataset.  I have typed changes into my textbox, but when I check dataset.HasChanges it is still set at False.

I thought if the dataset changed then the textbox would change as well as vice-versa, if the textbox changes, then the dataset would changes.

So, what do I need to do to ensure that when a textbox.text changes, then the bound dataset also changes?
vlvawterAsked:
Who is Participating?
 
SanclerCommented:
Changes made in bound controls are only committed to the dataset when the "current edit" ends.  That happens automatically if the user navigates to another record.  But otherwise you have to call .EndCurrentEdit for the binding manager concerned, before they will be reflected in .HasChanges.

If you have a CurrencyManager (e.g. so that "forward" and "back" buttons will work)

   MyCurrencyManager.EndCurrentEdit

should do it.  If not

   Me.BindingContext(<name of data Source>).EndCurrentEdit

should be OK.  In either case, put it just before your .HasChanges check.

Roger
0
 
vlvawterAuthor Commented:
Roger,

I've done a lot of experimenting, and the ADO flow is making more sense.  I use me.bindingsource.endedit, which produceds the same result as your code.

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.