moongodess Posted December 21, 2005 Posted December 21, 2005 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 :) Quote
Administrators PlausiblyDamp Posted December 21, 2005 Administrators Posted December 21, 2005 Have a look at the Microsoft.Win32.Registry class and some of it's related ones - everything you need should be there. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
moongodess Posted December 21, 2005 Author Posted December 21, 2005 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 ??? Quote
Leaders snarfblam Posted December 21, 2005 Leaders Posted December 21, 2005 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 } Quote [sIGPIC]e[/sIGPIC]
moongodess Posted December 22, 2005 Author Posted December 22, 2005 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.