Skip to content

Commit e2cd441

Browse files
authored
Merge pull request #7666 from MicrosoftDocs/main637804803980257024
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 350d8f7 + 93a646e commit e2cd441

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

docs/ide/managing-application-settings-dotnet.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Manage application settings (.NET)
3-
description: Learn how to manage application settings (formerly called dynamic properties) that are not included in the application code, but are needed at runtime.
3+
description: Learn how to manage application settings (formerly called dynamic properties) that aren't included in the application code, but are needed at runtime.
44
ms.custom: SEO-VS-2020
5-
ms.date: 11/04/2016
5+
ms.date: 02/14/2022
66
ms.topic: conceptual
77
f1_keywords:
88
- msvse_settingsdesigner.err.nameblank
@@ -17,11 +17,11 @@ ms.workload:
1717
---
1818
# Manage application settings (.NET)
1919

20-
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.
20+
Application settings enable you to store application information dynamically. Settings allow you to store information on the client computer that shouldn't be included in the application code (for example a connection string), user preferences, and other information you need at runtime.
2121

2222
Application settings replace the dynamic properties used in earlier versions of Visual Studio.
2323

24-
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.
24+
Each application setting must have a unique name. The name can be any combination of letters, numbers, or an underscore that doesn't start with a number, and it can't have spaces. The name is changed through the `Name` property.
2525

2626
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 <xref:System.Drawing.Color>, <xref:System.Object>, or as a connection string.
2727

@@ -31,19 +31,19 @@ In addition, application settings can be bound to a property of a form or contro
3131

3232
There are two types of application settings, based on scope:
3333

34-
- 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.
34+
- 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 can't change them at runtime.
3535

36-
- 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.
36+
- 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 runtime.
3737

3838
You can change the type of a setting by using the **Scope** property.
3939

4040
The project system stores application settings in two XML files:
4141

4242
- an *app.config* file, which is created at design time when you create the first application setting
4343

44-
- a *user.config* file, which is created at run time when the user who runs the application changes the value of any user setting.
44+
- a *user.config* file, which is created at runtime when the user who runs the application changes the value of any user setting.
4545

46-
Notice that changes in user settings are not written to disk unless the application specifically calls a method to do this.
46+
Notice that changes in user settings aren't written to disk unless the application specifically calls a method to do this.
4747

4848
## Create application settings at design time
4949

@@ -67,22 +67,22 @@ When you create a user-scoped setting (for example, default font, home page, or
6767

6868
You can add customized settings files to your project for convenient management of groups of settings. Settings that are contained in a single file are loaded and saved as a unit. Storing settings in separate files for frequently used and infrequently used groups can save time in loading and saving settings.
6969

70-
For example, you can add a file such as *SpecialSettings.settings* to your project. While your `SpecialSettings` class is not exposed in the `My` namespace, **View Code** can read the custom settings file that contains `Partial Class SpecialSettings`.
70+
For example, you can add a file such as *SpecialSettings.settings* to your project. While your `SpecialSettings` class isn't exposed in the `My` namespace, **View Code** can read the custom settings file that contains `Partial Class SpecialSettings`.
7171

72-
The **Settings Designer** first searches for the *Settings.settings* file that the project system creates; this file is the default file that the **Project Designer** displays in the **Settings** tab. *Settings.settings* is located in the *My Project* folder for [!INCLUDE[vbprvb](../code-quality/includes/vbprvb_md.md)] projects and in the *Properties* folder for [!INCLUDE[csprcs](../data-tools/includes/csprcs_md.md)] projects. The **Project Designer** then searches for other settings files in the project's root folder. Therefore, you should put your custom settings file there. If you add a *.settings* file elsewhere in your project, the **Project Designer** will not be able to locate it.
72+
The **Settings Designer** first searches for the *Settings.settings* file that the project system creates; this file is the default file that the **Project Designer** displays in the **Settings** tab. *Settings.settings* is located in the *My Project* folder for [!INCLUDE[vbprvb](../code-quality/includes/vbprvb_md.md)] projects and in the *Properties* folder for [!INCLUDE[csprcs](../data-tools/includes/csprcs_md.md)] projects. The **Project Designer** then searches for other settings files in the project's root folder. Therefore, you should put your custom settings file there. If you add a *.settings* file elsewhere in your project, the **Project Designer** won't be able to locate it.
7373

74-
## Access or change application settings at run time in Visual Basic
74+
## Access or change application settings at runtime in Visual Basic
7575

76-
In Visual Basic projects, you can access application settings at run time by using the `My.Settings` object. On the **Settings** page, click the **View code** button to view the *Settings.vb* file. *Settings.vb* defines the `Settings` class, which enables you to handle these events on the settings class: <xref:System.Configuration.ApplicationSettingsBase.SettingChanging>, <xref:System.Configuration.ApplicationSettingsBase.PropertyChanged>, <xref:System.Configuration.ApplicationSettingsBase.SettingsLoaded>, and <xref:System.Configuration.ApplicationSettingsBase.SettingsSaving>. Notice that the `Settings` class in *Settings.vb* is a partial class that displays only the user-owned code, not the whole generated class. For more information about accessing application settings by using the `My.Settings` object, see [Access application settings (.NET Framework)](/dotnet/visual-basic/developing-apps/programming/app-settings/accessing-application-settings).
76+
In Visual Basic projects, you can access application settings at runtime by using the `My.Settings` object. On the **Settings** page, click the **View code** button to view the *Settings.vb* file. *Settings.vb* defines the `Settings` class, which enables you to handle these events on the settings class: <xref:System.Configuration.ApplicationSettingsBase.SettingChanging>, <xref:System.Configuration.ApplicationSettingsBase.PropertyChanged>, <xref:System.Configuration.ApplicationSettingsBase.SettingsLoaded>, and <xref:System.Configuration.ApplicationSettingsBase.SettingsSaving>. Notice that the `Settings` class in *Settings.vb* is a partial class that displays only the user-owned code, not the whole generated class. For more information about accessing application settings by using the `My.Settings` object, see [Access application settings (.NET Framework)](/dotnet/visual-basic/developing-apps/programming/app-settings/accessing-application-settings).
7777

78-
The values of any user-scoped settings that the user changes at run time (for example, the position of a form) are stored in a *user.config* file. Notice that the default values are still saved in *app.config*.
78+
The values of any user-scoped settings that the user changes at runtime (for example, the position of a form) are stored in a *user.config* file. Notice that the default values are still saved in *app.config*.
7979

80-
If any user-scoped settings are changed during run time, for example in testing the application, and want to reset these settings to their default values, click the **Synchronize** button.
80+
If any user-scoped settings are changed during runtime, for example in testing the application, and want to reset these settings to their default values, click the **Synchronize** button.
8181

8282
We strongly recommend that you use the `My.Settings` object and the default *.settings* file to access settings. This is because you can use the **Settings Designer** to assign properties to settings, and, additionally, user settings are automatically saved before application shutdown. However, your Visual Basic application can access settings directly. In that case you have to access the `MySettings` class and use a custom *.settings* file in the root of the project. You must save the user settings before ending the application, as you would do for a C# application; this is described in the following section.
8383

8484
<!-- markdownlint-disable MD003 MD020 -->
85-
## Access or change application settings at run time in C#
85+
## Access or change application settings at runtime in C#
8686
<!-- markdownlint-enable MD003 MD020 -->
8787

8888
In languages other than Visual Basic, such as C#, you must access the `Settings` class directly, as shown in the following [!INCLUDE[csprcs](../data-tools/includes/csprcs_md.md)] example.

0 commit comments

Comments
 (0)