Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type 'RegistryKey' is not defined...

Status
Not open for further replies.

MrBridger

Programmer
Jun 23, 2003
4
IE
Hi all,

I am new to VisualStudio.NET/Visual Basic and I'm trying to read/write values to the Windows Registry. However when I put the following code into my Form I get the above error message (in the Subject of this thread). The "RegistryKey" type is well documented but when I run the program I get the error. Also I have added a reference to the RegistryKey class.

Any help would be great, thanks in advance.

_RJO.

============================================================
Public Class RegMod
Inherits System.Windows.Forms.Form

Private Sub main()
Dim RegKey As RegistryKey = Registry.CurrentUser
RegKey = RegKey.OpenSubKey("Software\Microsoft\Internet Explorer\Main\")
Dim val As Object = RegKey.GetValue("VendorIdentifier")
Console.WriteLine("The central processor of this machine is:" + val)
End Sub
End Class
============================================================
 
You need to import the Microsoft.Win32 namespace into your module in order to reference the Registry class.

Put the following at the very top of your module code:

Imports Microsoft.Win32
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top