Use of Registry.SetValue in VB.NET
The SetValue method opens a registry key, sets the value, and closes the key each time it is called.
AS you learned in previous article Registry.GetValue is used to read from the Windows registry, it retrieves the value associated with the specified name, in the specified registry key.
This article is the concept of second method type of window registry that is Registry.SetValue, windows registry to be a suitable place for storing application specific information and configuration settings. The SetValue method opens a registry key, sets the value, and closes the key each time it is called. If you need to modify a large number of values, the RegistryKey.SetValue method might provide better performance.
The list given below have all the methods which we use in Windows registry:
-
Close
-
CreateSubKey
-
DeleteSubKey
-
DeleteSubKeyTree
-
DeleteValue
-
Flush
-
GetSubKeyNames
-
GetValue
-
GetValuesNames
-
OpenSubKey
-
SetValue
Syntex
Registry.SetValue ( number MainKey,
string SubKey,
string Value,
string Data,
number Type = REG_SZ )
Example:
Public Class Key
Public Shared Sub Main()
Console.WriteLine(My.Computer.Registry.GetValue
("HKEY_CURRENT_USER\Software\yourname\subname\",
"PromptOnExit", "0"))
Console.ReadLine()
End Sub
End Class