Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 2.26 KB

how-to-persist-user-settings.md

File metadata and controls

36 lines (26 loc) · 2.26 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: How to: Persist User Settings in Visual Basic
How to: Persist User Settings
07/20/2015
My.Settings object [Visual Basic], persisting user settings
persistence [Visual Basic], persisting user settings [Visual Basic]
user settings [Visual Basic], persisting
0e5e6415-b6e2-4602-9be0-a65fa167d007

How to: Persist User Settings in Visual Basic

You can use the My.Settings.Save method to persist changes to the user settings.

Typically, applications are designed to persist the changes to the user settings when the application shuts down. This is because saving the settings can take, depending on several factors, several seconds.

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 creating the application, through the Project Designer, or by editing the application's configuration file. For more information, see Managing Application Settings (.NET).

Example

This example changes the value of the LastChanged user setting and saves that change by calling the My.Settings.Save method.

[!code-vbVbVbalrMyResources#5]

For this example to work, your application must have a LastChanged user setting, of type Date. For more information, see Managing Application Settings (.NET).

See also