Test for Registry Key/Value

  • Thread starter Thread starter Yogi_Bear_79
  • Start date Start date
Yogi_Bear_79,

You can use the RegistryKey class in the Microsoft.Win32 namespace. You
can call the GetValue method, which will return null if the value doesn't
exist. To check to see if a key exists, you can call the OpenSubKey method,
which will also return null if it doesn't exist.

Hope this helps.
 
I've been trying variations on that concept before and after my original
question with no luck. Can you give me a quick "aircode" example?

using (RegistryKey Key = Registry.CurrentUser)

{

if (Key.OpenSubKey(sKey)= null)

{

}

}

Nicholas Paldino said:
Yogi_Bear_79,

You can use the RegistryKey class in the Microsoft.Win32 namespace. You
can call the GetValue method, which will return null if the value doesn't
exist. To check to see if a key exists, you can call the OpenSubKey method,
which will also return null if it doesn't exist.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Yogi_Bear_79 said:
How do you test to see if a Registry Key & a Value exsist?
 
Back
Top