Partilhar via


Objeto My.Settings (Visual Basic)

Provides properties and methods for accessing the application's settings.

Comentários

The My.Settings object provides access to the application's settings and allows you to dynamically store and retrieve property settings and other information for your application. For more information, see Gerenciando definições de aplicativo.

Properties

The properties of the My.Settings object provide access to your application's settings. To add or remove settings, use the Settings Designer. For more information, see Como: Adicionar ou remover configurações do aplicativo.

Each setting has a Name, Type, Scope, and Value, and these settings determine how the property to access each setting appears in the My.Settings object:

  • Name determines the name of the property.

  • Type determines the type of the property.

  • Scope indicates if the property is read-only. If the value is Application, the property is read-only; if the value is User, the property is read-write.

  • Value is the default value of the property.

Methods

Method

Description

Reload

Reloads the user settings from the last saved values.

Save

Saves the current user settings.

The My.Settings object also provides advanced properties and methods, inherited from the ApplicationSettingsBase class.

Tasks

The following table lists examples of tasks involving the My.Settings object.

To

See

Read an application setting

Como: Configurações do aplicativo de leitura no Visual Basic

Change a user setting

Como: Alterar as configurações de usuário em Visual Basic

Persist user settings

Como: Configurações de usuário em Visual Basic

Create a property grid for user settings

Como: Criar grades de propriedades para configurações de usuário no Visual Basic

Exemplo

This example displays the value of the Nickname setting.

Sub ShowNickname()
    MsgBox("Nickname is " & My.Settings.Nickname)
End Sub

For this example to work, your application must have a Nickname setting, of type String. For more information, see Como: Adicionar ou remover configurações do aplicativo.

Consulte também

Tarefas

Como: Configurações do aplicativo de leitura no Visual Basic

Como: Alterar as configurações de usuário em Visual Basic

Como: Configurações de usuário em Visual Basic

Como: Criar grades de propriedades para configurações de usuário no Visual Basic

Como: Adicionar ou remover configurações do aplicativo

Referência

ApplicationSettingsBase

Outros recursos

Gerenciando definições de aplicativo