Determines whether the application saves the user settings on exit.
' Usage Dim value As Boolean = My.Application.SaveMySettingsOnExit ' Declaration Public Property SaveMySettingsOnExit As Boolean
The SaveMySettingsOnExit property allows the user to change how the application saves settings, at run time. You can explicitly save setting changes by using themethod of the My.Settings object. For more information about changing and saving settings, see .
The changes to this property are not persisted when the application closes. To change the SaveMySettingsOnExit property permanently, you must change the setting in the Project Designer:
To change the setting in the Project Designer
Have a project selected in Solution Explorer. Click Properties on the Project menu.
Click the Application tab.
Select Save My.Settings on Shutdown.
For more information, see.
This example has two parts.
The InitializeSaveMySettingsOnExit subroutine, which initializes the checked state of acontrol to the current value of the SaveMySettingsOnExit property.
The SaveMySettingsOnExit_CheckedChanged subroutine, which handles changes to a CheckBox control to update the My.Application.SaveMySettingsOnExit property.
Private Sub InitializeSaveMySettingsOnExit() SaveMySettingsOnExit.Checked = _ My.Application.SaveMySettingsOnExit End Sub Private Sub SaveMySettingsOnExit_CheckedChanged( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs _ ) Handles SaveMySettingsOnExit.CheckedChanged My.Application.SaveMySettingsOnExit = _ SaveMySettingsOnExit.Checked End Sub
For this example to work, your application must have a CheckBox control named SaveMySettingsOnExit.