Returns a key setting value from an application's entry in the Windows registry.
The My feature gives you greater productivity and performance in registry operations than GetAllSettings. For more information, see My.Computer.Registry Object.
Public Function GetSetting( _ ByVal AppName As String, _ ByVal Section As String, _ ByVal Key As String, _ Optional ByVal Default As String = "" _ ) As String
One or more arguments are not String expressions, 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.
If any of the items named in the GetSetting arguments do not exist, GetSetting returns a value of Default.
Because it operates under the HKEY_LOCAL_USER registry key, which is not active until a user logs on interactively, GetSetting requires that a user be logged on.
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.
GetSetting requires Read Registry Permission.
This example first uses the SaveSetting function to make entries in the Windows registry for the application specified as AppName, and then uses the GetSetting function to display one of the settings. Because the Default argument is specified, some value is guaranteed to be returned. Notice that Section names cannot be retrieved with GetSetting. Finally, the DeleteSetting function removes all the application's entries.
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)