Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 :)

Posted
Have a look at the Microsoft.Win32.Registry class and some of it's 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

???

  • Leaders
Posted

You could do something like...

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
}

[sIGPIC]e[/sIGPIC]
Posted

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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...