Dela via


Settings Page, Project Designer

Use the Settings page of the Project Designer to specify a project's application settings. Application settings enable you to store and retrieve property settings and other information for your application dynamically. They also enable you to maintain custom application and user preferences on a client computer. For more information, see Application Settings.

To access the Settings page, select a project node in Solution Explorer, and then, on the Project menu, click Properties. When the Project Designer appears, click the Settings tab.

Header Bar

The following controls are located in the header bar at the top of the Settings page.

  • Synchronize
    Restores user-scoped settings that the application uses at run time (or during debugging) to their default values as defined at design time. The data is restored by removing runtime-generated application-specific files from disk (not from project data).

  • Load Web Settings
    Displays a Login dialog box that enables you to load settings for an authenticated user or for anonymous users. For more information, see Login Dialog Box, Settings Page, Project Designer. This button is enabled only when you have enabled client application services on the Services page and specified a Web settings service location. For more information about the Web settings service, see Client Application Services.

  • View Code
    For Visual Basic projects, enables you to view the code in the Settings.vb file. This file defines the MySettings class, which enables you to handle specific events on the My.Settings object. For more information about accessing application settings by using the My.Settings object, see Accessing Application Settings.

    For Visual C# projects, enables you to view the code in the Settings.cs file. This file defines the Settings class, which enables you to handle specific events on the Settings object. Note that in languages other than Visual Basic, you must explicitly call the Save method of this wrapper class in order to persist the user settings. You usually do this in the Closing event handler of the main form. For an example of a call to the Save method, see Application Settings.

    For more information about accessing application settings, see Application Settings for Windows Forms.

  • Access modifier
    Specifies the access level of the Properties.Settings (in C#) or My.Settings (in Visual Basic) helper classes that Visual Studio generates in Settings.Designer.cs or Settings.Designer.vb.

    For Visual C# projects, the access modifier can be Internal or Public.

    For Visual Basic projects, the access modifier can be Friend or Public.

    By default, the setting is Internal (in C#) or Friend (in Visual Basic). When Visual Studio generates helper classes as Internal or Friend, executable (.exe) applications cannot access the resources and settings that you have added to class libraries (.dll files). If you have to share resources and settings from a DLL, set the access modifier to Public.

    For more information about Properties.Settings (in C#) or My.Settings (in Visual Basic) helper classes, see Application Settings.

Settings Grid

The settings grid is used to configure application settings. This grid includes the following columns.

  • Name
    Type the name of the application setting in this field.

  • Type
    Use the drop-down list to select a type for the setting. The most frequently used types appear in the drop-down list—for example, String, (Connection string), and System.Drawing.Font. You can choose another type by selecting Browse at the end of the list, and then selecting a type from the Select a Type Dialog Box. Notice that after you choose a type from this dialog box, that type is added to the common types in the drop-down list (for the current solution only).

  • Scope
    Select either Application or User.

    Application-scoped settings (such as connection strings) are associated with the application; users cannot change them at run time.

    User-scoped settings (such as system fonts) are intended to be used for user preferences; users can change them at run time.

  • Value
    The data or value associated with the application setting. For example, if the setting is a font, its value could be Verdana, 9.75pt, style=Bold.

See Also

Tasks

How to: Add or Remove Application Settings

How to: Access Settings Events

Concepts

Application Settings

Accessing Application Settings

Reference

Select a Type Dialog Box

Other Resources

Managing Application Settings

Application Settings for Windows Forms

Projects, User Interface Elements