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.
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.
This example changes the value of the LastChanged user setting and saves that change by calling the My.Settings.Save method.
For this example to work, your application must have a LastChanged user setting, of type Date. For more information, see Managing Application Settings.