Saves or creates an application entry in the Windows registry.
The My feature gives you greater productivity and performance in registry operations than SaveSetting. For more information, see My.Computer.Registry Object.
Public Sub SaveSetting( _ ByVal AppName As String, _ ByVal Section As String, _ ByVal Key As String, _ ByVal Setting As String _ )
Key registry could not be created, or user is not logged in.
See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the Number Property (Err Object).) However, when possible, you should consider replacing such error control with Structured Exception Handling Overview for Visual Basic.
The SaveSetting function adds the key to HKEY_CURRENT_USER\Software\VB and VBA Program Settings.
If the key setting cannot be saved for any reason, an error occurs.
SaveSetting requires that a user be logged on since it operates under the HKEY_LOCAL_USER registry key, which is not active until a user logs on interactively.
Registry settings that are to be accessed from a non-interactive process (such as Mtx.exe) should be stored under either the HKEY_LOCAL_MACHINE\Software\ or the HKEY_USER\DEFAULT\Software registry keys.
SaveSetting requires Write and Create Registry Permission.
The following example first uses the SaveSetting function to make entries in the Windows registry for the MyApp application, and then uses the DeleteSetting function to remove them.
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)