Search code examples
winformssaveapplication-settings

winform's Application Settings : cannot save application settings which has been added during the run time


I having some issues with saving Application settings during the run time...

If i change the setting scope to user, it works fine, but in application scope, nothing being happened...

I've used :

Properties.Settings.Default.Save();

any ideas ?

thanks


Solution

  • That's because setting the scope to Application makes it read-only.

    See Using Settings in C#

    Application-scope settings are read only, and can only be changed at design time or by altering the .exe.config file in between application sessions. User-scope settings, however, can be written at run time, just as you would change any property value. The new value persists for the duration of the application session. You can persist changes to user settings between application sessions by calling the Settings.Save method.