tags:

views:

50

answers:

1

i'm trying to delete a registry from the Local_Machine\Software in the registry i made a key titles "DeleteMe" as a test to try it out but i cant get it to work iv tried multiple options and they all say that the "subkey" "subkeytree" and "value" do not exist BUT IT DOES! and i hope i'm using the right terminology here to its HKEY_LOCAL_MACHINE\SOFTWARE\DeleteMe i want it and all the sub keys/values deleted.. (i hope key is the right terminology they look just like folders but when right clicked on they have the option "copy key name")

so far best looking thing iv tried was this and i am running Admin on Windows 7 (but i want this to work regardless of the os)

            string keyName = @"Software\DeleteMe";
        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName, true))
        {
            if (key == null)
            {
                MessageBox.Show("Not Found");
            }
            else
            {
                key.DeleteSubKeyTree("DeleteMe");
            }
        }
+1  A: 

Check out this previous answer on StackOverflow. A pretty good summation of the process. Anything you're doing different from this?

http://stackoverflow.com/questions/531151/how-to-delete-registry-value-in-c

Jeff
@jeff yes iv looked there and EVERY thing i tried i get "cannot delete a subkey tree because the subkey does not exist) so i think im missing something.. donno what tho.
NightsEVil
Again - have any code we can look at to see where an issue may lie? O/S? Running application as administrator if on Vista or Windows 7?
Jeff