• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

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?
0
vlvawter
Asked:
vlvawter
1 Solution
 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now