Reputation: 29153
I'm binding user settings to a bunch of controls on a WinForm dialog that has OK/Cancel buttons. While this works great to read in the bindings in, I would only like to commit binding changes if a user clicks OK, and not if they click cancel. Is there a simplistic setting to achieve this rather than managing all reading and committing myself?
Right now, let's say I have a textbox that binds to a user setting called "country". It has "United States" in it and if a user changes it to "Bolivia", that will get committed as soon as it is typed instead of when the OK button is pressed.
Upvotes: 3
Views: 674
Reputation: 23841
To save settings, add in the ok button event handler:
Properties.Settings.Default.Save();
To reload the settings:
Properties.Settings.Default.Reload();
Good luck!
Upvotes: 2