Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
You can change a user setting by assigning a new value to the setting's property on the My.Settings
object.
The My.Settings
object exposes each setting as a property. The property name is the same as the setting name, and the property type is the same as the setting type. The setting's Scope determines if the property is read-only: The property for an Application-scope setting is read-only, while the property for a User-scope setting is read-write. For more information, see My.Settings Object.
Note
Although you can change and save the values of user-scope settings at run time, application-scope settings are read-only and cannot be changed programmatically. You can change application-scope settings when you create the application by using the Project Designer or by editing the application's configuration file. For more information, see Managing Application Settings (.NET).
This example changes the value of the Nickname
user setting.
Sub ChangeNickname(ByVal newNickname As String)
My.Settings.Nickname = newNickname
End Sub
For this example to work, your application must have a Nickname
user setting, of type String
.
The application saves the user settings when the application shuts down. To save the settings immediately, call the My.Settings.Save
method. For more information, see How to: Persist User Settings in Visual Basic.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Store and retrieve data using literal and variable values in C# - Training
Use data in your applications by creating literal values and variable values of different data types.