I've been playing with the RegistryKey class in the Microsoft.Win32
namespace.
I can do various things but I can't seem to get the syntax correct to see if
a value or a key exsists.
I know I need to use the GetValue & OpenSubKey methods
I've been trying variations on these methods with no luck.
Can someone give me a working example?
I've been playing with the RegistryKey class in the Microsoft.Win32
namespace.
I can do various things but I can't seem to get the syntax correct to see if
a value or a key exsists.
I know I need to use the GetValue & OpenSubKey methods
I've been trying variations on these methods with no luck.
Can someone give me a working example?
For one thing, your "using" block is guarding the wrong thing there -
you don't really want to dispose of the Registry.CurrentUser key, as
that's always open. You want something like:
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(sKey))
{
if (key==null)
{
....
}
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.