Registry: Load, Save and Enumerate

moongodess

Active member
Joined
Dec 23, 2004
Messages
40
I need to do a class to write and read some specific values in the registry.
That is quite simple....

What I really need to know is:
- How to check if a key exists
- How to check if a value exists
- How to get all sub key in a single key

Thanks for any help :)
 
PlausiblyDamp said:
Have a look at the Microsoft.Win32.Registry class and some of its related ones - everything you need should be there.

As you told me :) I took a look at that class... But all I can get (at least, what I saw) was how to get all the subkeys on current_config, current_user, etc...

How do I specify a key to be seached, for example:
HKEY_CURRENT_USER\Software\Settings\MyProg\Grid\Columns
???
 
You could do something like...
C#:
Microsoft.Win32.RegistryKey MyKey
	= Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\Settings\\MyProg\\Grid\\Columns");
if(MyKey == null) {
	// Key does not exist.
} else {
	// Key exists.
	MyKey.GetValue("Bork");
	// Gets the "Bork" value on HKCU\Software\Settings\MyProg\Grid\Columns
}
 
Thanks for all help :)
I thank your help would solve my problem, but... my boss found another way to do what I need :o
Thank you all... And sorry for the time you spend...
I have no doubt that there will be another ocasion to practise this :)
 
Back
Top