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.
  • 4942

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:

  1. Close

  2. CreateSubKey

  3. DeleteSubKey

  4. DeleteSubKeyTree

  5. DeleteValue

  6. Flush

  7. GetSubKeyNames

  8. GetValue

  9. GetValuesNames

  10. OpenSubKey

  11. 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

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.