Save Custom User Settings & Preferences

Your C# application settings allow you to store and retrieve custom property settings and other information for your application. These properties & settings can be manipulated at runtime using ProjectNameSpace.Settings.Default.PropertyName. The .NET Framework allows you to create and access values that are persisted between application execution sessions. These settings can represent user preferences, or valuable information the application needs to use or should have. For example, you might create a series of settings that store user preferences for the color scheme of an application. Or you might store a connection string that specifies a database that your application uses. Please note that whenever you create a new Database, C# automatically creates the connection string as a default setting.

Settings allow you to both persist information that is critical to the application outside of the code, and to create profiles that store the preferences of individual users. They make sure that no two copies of an application look exactly the same & also that users can style the application GUI as they want.

To create a setting :

*Right Click on the project name in the explorer window; Select Properties

*Select the settings tab on the left

*Select the name & type of the setting that required

*Set default values in the value column


Suppose the namespace of the project is ProjectNameSpace & property is  PropertyName.

To modify the setting at runtime and subsequently save it :

  • ProjectNameSpace.Settings.Default.PropertyName = DesiredValue;

  • ProjectNameSpace.Properties.Settings.Default.Save();

The synchronize button overrides any previously saved setting with the ones specified on the page.