15.4. Read and Write to the Windows Registry


You need to read information from, or write information to, the Windows registry.


Use the methods GetValue and SetValue of the Microsoft.Win32.Registry class.

The GetValue and SetValue methods open a registry key, get or set its value, and close the key each time they are called. This means they are inefficient when used to perform many read or write operations. The GetValue and SetValue methods of the Microsoft.Win32.RegistryKey class, discussed in recipe 15-5, will provide better performance if you need to perform many read or write operations on the registry.

How It Works

The ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.