How to: Add or Remove Application Settings
Application settings allow you to store and retrieve property settings and other information for your application dynamically. There are two types of application settings, based on scope: user-scoped and application-scoped settings.
At design time, you can add application settings either using the Settings pane of the Project Designer (Visual Basic and Visual C# only), or using the Properties window for a form or control, which allows you to bind a setting directly to a property.
To add application settings in the Project Designer
Select a project in Solution Explorer; on the Project menu, click Properties.
Select the Settings pane.
Click a blank row in the Settings grid.
Enter a name for the setting in the Name column. The name cannot contain spaces.
Select a data type for the setting from the Type drop-down list.
Select the scope of the setting from the Scope drop-down list. The setting's scope can be Application or User.
Enter a default value for the setting in the Value column. The value must be appropriate for the selected data type.
To add application settings in the Properties window
Select a form or control in the Form Designer; on the View menu, click Properties Window.
In the Properties window, expand the (Application Settings) property (located under the Data node).
Select the (Property Binding) property and click the ellipsis button (...) to open the Application Settings dialog box.
In the Application Settings dialog box, select the property for which you wish to add an application setting.
In the drop-down list for the property, click (New...) to open the New Application Setting dialog box.
In the New Application Setting dialog box, select the Name property and enter a name for the setting. The name cannot contain spaces.
Select the DefaultValue property and enter a default value for the setting.
Select the scope of the setting from the Scope drop-down list. The setting's scope can be Application or User.
To bind the new setting to the property, select it from the drop-down list, then click OK.
The property binding will be added to the Properties window, and the new setting will be added to the Project Designer. Note that once you have created the setting, you must use the Project Designer to change it.
To remove application settings
Select a project in Solution Explorer; on the Project menu, click Properties.
Select the Settings pane.
Click on the row in the Settings grid for the setting you wish to remove.
Press the Delete key, or right-click and select Remove Setting.
The setting will be removed from the Project Designer.
Not
You will need to remove settings manually from app.config because the Project Designer does not remove any references to application settings in your code or its own code.
See Also
Tasks
How to: Access Settings Events
Concepts
Accessing Application Settings (Visual Basic)