Application settings enable you to store application information dynamically.
Settings allow you to store information on the client computer that should not be included in the application code (for example a connection string), user preferences, and other information you need at run time.
Each application setting must have a unique name. The name can be any combination of letters, numbers, or an underscore that does not start with a number, and it cannot have spaces. The name is changed through the Name property.
Application settings can be stored as any data type that is serialized to XML or has a TypeConverter that implements ToString/FromString. The most common types are String, Integer, and Boolean, but you can also store values as Color, Object, or as a connection string.
Application settings also hold a value. The value is set with the Value property and must match the data type of the setting.
In addition, application settings can be bound to a property of a form or control at design time.
There are two types of application settings, based on scope:
•Application-scoped settings can be used for information such as a URL for a web service or a database connection string. These values are associated with the application. Therefore, users cannot change them at run time.
•User-scoped settings can be used for information such as persisting the last position of a form or a font preference. Users can change these values at run time.
You can change the type of a setting by using the Scope property.
The project system stores application settings in two XML files:
•an app.config file, which is created at design time when you create the first application setting
•a user.config file, which is created at run time when the user who runs the application changes the value of any user setting.
Notice that changes in user settings are not written to disk unless the application specifically calls a method to do this.
The Settings Property page allows you to open up a settings editor for project settings. The definition for these settings will be stored in the Properties folder of your project.
The values of these settings will be stored in a app.config file in the root folder of your project.
Just like in the resource editor you can also choose the visibility of the generated code (the IDE generates a file called Settings.Designer.prg). This also changes the "Custom Tool" property of the Settings file.
When you compile your project then MsBuild will generate a copy of app.config and will rename it to <yourapp>.exe.config in the output folder of your project.