0

I wanna delete this registry key:

enter image description here

I tried a many codes but nothing worked, someone got an idea how to delete these? And I tried DeleteSubKeyTree too.. Nothing worked yet.

I tried this:

Try Dim x As Microsoft.Win32.RegistryKey x =
  Microsoft.Win32.Registry.localmachine.OpenSubKey("HKEY_LOCAL_MACHINE\Software\VB", True) 
  x.DeleteSubKeyTree("Test") 
catch ex as exception 
    messagebox.show ex.tostring() 
end try

But then I'm getting an error or exception that says:

the subkey doesnt exist

I wanna delete "MyTestKey" on the picture and its subkeys..

braX
  • 11,506
  • 5
  • 20
  • 33
ιcσяεx
  • 19
  • 1
  • 4
  • 1
    Show what you tried... – Equalsk Feb 12 '18 at 13:34
  • I tried things like this: Try Dim x As Microsoft.Win32.RegistryKey x = Microsoft.Win32.Registry.localmachine.OpenSubKey("HKEY_LOCAL_MACHINE\Software\VB", True) x.DeleteSubKeyTree("Test") catch ex as exception messagebox.show ex.tostring() end try -- But nothing worked – ιcσяεx Feb 12 '18 at 13:41
  • Edit your question, add the code and format it properly. Code in comments isn't easy to read. When you tried the code you posted, what didn't work exactly? Help us to help you... – Equalsk Feb 12 '18 at 13:42
  • Ok, I edited my question – ιcσяεx Feb 12 '18 at 13:46
  • 1
    Your code says to delete the SubKeyTree called "Test" yet your screenshot and comments say it's called "TestKey". We can't even see your registry tree as the screenshot cuts it off. – Equalsk Feb 12 '18 at 13:52
  • I just wanna delete the Key "MyTestKey" and "Testkey" then subkey "Testkey" and "testkey1" you understand? Sry for my bad english. – ιcσяεx Feb 12 '18 at 13:53
  • And I didnt edited the code, the "test" must be "MyTestKey" – ιcσяεx Feb 12 '18 at 13:58
  • Possible duplicate of [NullReferenceException when opening a subkey I know exists](https://stackoverflow.com/questions/48492135/nullreferenceexception-when-opening-a-subkey-i-know-exists) (see the answer) – Visual Vincent Feb 12 '18 at 15:25

0 Answers0