Click here to Skip to main content
14,773,203 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HOW TO DELETE REGISTRY VALUES WITH NAMES (Default) because I am finding difficulty in deleting registry values with name (Default).

Please help..
Posted
Comments
AmitGajjar 5-Apr-12 8:10am
   
do not use capitalization, it shows shouting :@

1 solution

string keyName = @"Software\Microsoft\Windows\CurrentVersion\Run";
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true))
{
    if (key == null)
    {
        // Key doesn't exist. Do whatever you want to handle
        // this case
    }
    else
    {
        key.DeleteValue("MyApp");
    }
}
   
Comments
djrocks0101 5-Apr-12 7:16am
   
here Key name is (Default)..system generates a run-time error..when I am trying this..RegistryKey key = Registry.CurrentUser.OpenSubKey("(Default)", true)
djrocks0101 5-Apr-12 7:18am
   
ok I got it..
Thanks..
djrocks0101 5-Apr-12 7:24am
   
But still have the same problem...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900