ARTICLE

Work with Registry.SetValue in VB.NET

Posted by Sapna Articles | Visual Basic 2010 April 13, 2011
The SetValue method opens a registry key, sets the value, and closes the key each time it is called.
 
Reader Level:

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

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor