How to change application settings (Settings) while app is open?

agnieszka picture agnieszka · Jul 23, 2009 · Viewed 16.3k times · Source

I've written a class that should allow me to easily read and write values in app settings:

public static class SettingsManager
    {
        public static string ComplexValidationsString
        {
            get { return (string)Properties.Settings.Default["ComplexValidations"]; }
            set
            {
                Properties.Settings.Default["ComplexValidations"] = value;
                Properties.Settings.Default.Save();
            }
        }

the problem is the value isn't really saved, I mean it is not changed when I exit the application and run it again. What can I do to ensure that the saved value persists between closing and opening again?

Answer

Woland picture Woland · Jul 23, 2009

settings scope must be user not application