Skip to content

Latest commit

 

History

History
42 lines (35 loc) · 2.64 KB

File metadata and controls

42 lines (35 loc) · 2.64 KB
title How to: Persist User Settings in Visual Basic
ms.custom
ms.date 07/20/2015
ms.prod .net
ms.reviewer
ms.suite
ms.technology
devlang-visual-basic
ms.topic article
helpviewer_keywords
My.Settings object [Visual Basic], persisting user settings
persistence [Visual Basic], persisting user settings [Visual Basic]
user settings [Visual Basic], persisting
ms.assetid 0e5e6415-b6e2-4602-9be0-a65fa167d007
caps.latest.revision 15
author dotnet-bot
ms.author dotnetcontent

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

My.Settings Object
How to: Read Application Settings in Visual Basic
How to: Change User Settings in Visual Basic
How to: Create Property Grids for User Settings in Visual Basic
Managing Application Settings (.NET)