DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Open/Creates A Base Key In The Registry
// open a Base Key in the registry
public static RegistryKey GetKey(string baseKey)
{
RegistryKey key;
try
{
key = Registry.LocalMachine.OpenSubKey(baseKey, true);
if (key == null)
{
key = Registry.LocalMachine.CreateSubKey(baseKey);
}
else
{
MessageBox.Show("Base key resolved");
}
}
catch (Exception e)
{
return null;
}
return key;
}





