Saturday, December 29, 2007

C#: Delete a specific key from a registry

public bool DeleteRegistryKey(Microsoft.Win32.RegistryKey regHive, string regKey, string regName)
{
bool response = false;

Microsoft.Win32.RegistryKey key = regHive.OpenSubKey(regKey, true);
if (key == null)
{
response = true;
}
else
{
key.DeleteValue(regName);
}
response = true;

return response;
}

1 comment:

  1. THAT'S NOT DELETING A KEY.. IT'S DELETING A VALUE.. >_<

    ReplyDelete

Please use your common sense before making a comment, and I truly appreciate your constructive criticisms.