Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check for changes on the BindingSource and cancel them

Status
Not open for further replies.

Shimmy613

Programmer
Feb 14, 2011
39
US
I'm sure this question has been asked and answered a million times, but I've been Googling and can't come up with an answer that works for me...

I've got a bunch of UI controls wired up to a BindingSource. I've got the databinding set up to update the objects on PropertyChanged. I need to now implement a "cancel button" - but I can't find any way that works (EndEdit, EndCurrentEdit, CancelEdit, etc.) to roll back the changes - or to even view the old values in the debugger. I've tried the "BindingSource_CurrentChanged" and "BindingSource_CurrentItemChanged" events with no success - it seems the original values are gone.

I know I could manually create a full copy of the object at the beginning and then create a whole manual compare function - but that seems pretty poor...

Any ideas, please?

Thanks!!!
 
Slight (but insignificant correction) - the databinding's "Data Source Update Mode" is set to OnValidation, not OnProperyChanged, like I wrote above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top