Registry.GetValue in VB.NET

Registry.GetValue is used to read from the Windows registry, it retrieves the value associated with the specified name.
  • 5598
Registry.GetValue is used to read from the Windows registry, it retrieves the value associated with the specified name, in the specified registry key. If the name is not found in the specified key, returns a default value that you provide, or Nothing if the specified key does not exist. It is using the Registry.GetValue method in the Microsoft.Win32 namespace in VB.NET.

reg.gif

 
The Registry.GetValue method takes two strings and an object for parameters. The first parameter is a string for the registry key name. The second parameter is a string for the value name. The third parameter is an object that will be returned if the value does not exist. We will return null is the value does not exist.

Syntex

string Registry.GetValue ( number  MainKey,
                           string  SubKey,
                           string  Value,
                           boolean AutoExpand = true )

Example:

public class key
   public Shared Sub Main
        Console.WriteLine(My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\yourname\subname\","PromptOnExit", "0"))

   End Sub
End Class

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.