Location My.Computer.Registry.GetValue Syntax Dim result As Object = My.Computer.Registry.GetValue(keyName, _ valueName, defaultValue)
keyName (required; String) The hierarchy key under which to query the value for data.
valueName (required; Object) The name of the value to be queried within the key. To retrieve the default value (the "(Default)" entry) for a particular key, use Nothing or an empty string for this parameter.
defaultValue (required; Object) The default data to be returned if the value does not exist. To indicate no default value, use the Nothing keyword for this parameter. Description The GetValue method returns the data for a value entry in the registry. All values are stored within "keys," the main hierarchy nodes within the registry. Usage at a Glance You must have sufficient security permissions to read or write keys and values in the registry. keyName must start with the name of a valid registry hive, such as HKEY_CURRENT_USER. This function returns data as type Object. If Option Strict is set to true, you will likely need to convert the data to another type before use. For example, when retrieving string results, use the CStr function to convert the result to a String. Example The following code retrieves a string from the registry. ' ----- If the error limit is not recorded in the registry, ' use a reasonable value like 5. Dim errorLimit As String = CStr(My.Computer.Registry.GetValue( _ "HKEY_CURRENT_USER\Software\MyCompany\MySoftware", _ "ErrorLimit", "5")) Related Framework Entries See Also ClassesRoot Property, CurrentConfig Property, CurrentUser Property, DynData Property, LocalMachine Property, PerformanceData Property, Registry Object, SetValue Method, Users Property |