[RESOLVED] Cancel Changes with BindingSource
I have a datagridview bound to a bindingsource which has a datatable (an access mdb file) as the underlying data storage.
I've been saving changes like this (which seems to be working fine):
Code:
EventBindingSource.EndEdit() 'apply changes to underlying datasource
EventTableAdapter.Update(TimetrackerDataSet)
Now if the user selects to NOT save the changes, I tried to do this:
Code:
EventBindingSource.CancelEdit()
'EventBindingSource.ResetCurrentItem()
'EventBindingSource.ResetBindings(False)
EventTableAdapter.Update(TimetrackerDataSet)
And it indeed does not save the changes to the database, but if I am still working in the datagridview and happen to call up the record that was edited again, the changes are still there. If I close the form and reopen it then the changes are gone (like they should be).
Is there a more direct way to say "forget everything since the last save and make the datagridview reflect that"?
Thanks
Dave
Re: Cancel Changes with BindingSource
what about rebinding the gridview with the copy of the Original datatable !
Re: Cancel Changes with BindingSource
Call RejectChanges on the underlying datatable.