Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commit Application Settings Changes

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.

like image 493
Todd Main Avatar asked Sep 08 '26 17:09

Todd Main


1 Answers

To save settings, add in the ok button event handler:

Properties.Settings.Default.Save();

To reload the settings:

Properties.Settings.Default.Reload();

Good luck!

like image 173
Homam Avatar answered Sep 10 '26 07:09

Homam