I have 7 different bindingsources on a form right now and I have a "cancel" button to allow a user to reject the changes they made and revert back to the original data in the dataset.
Instead of having my cancel button click event call something like:
private void buttonCancelChanges_Click(object sender, EventArgs e)
{
dS_DataSet.RejectChanges();
BindingSource1.ResetBindings(true);
BindingSource2.ResetBindings(true);
BindingSource3.ResetBindings(true);
BindingSource4.ResetBindings(true);
BindingSource5.ResetBindings(true);
BindingSource6.ResetBindings(true);
BindingSource7.ResetBindings(true);
ToggleEditMode();
}
can I just loop through all of the existing binding sources on the form? I can't figure out how to do that if you can.
Any suggestions, or is this really the only way to do it?