RegistryItem.Delete why are you so awkward?

Has anyone got a working example of RegistryItem.Delete?

I’ve tried every permutation I can think of to remove a key (an empty folder, not a name:value pair) and it just does nothing while reporting no errors.

The documentation doesn’t help either.

RegistryItem.Delete ( Name as String )
Deletes the passed RegistryItem.

So it deleted the passed RegistryItem you say? I say nope.
What exactly is Name? Is that the name of the Key ? Does it need to be a full path or a sub path? Do you need a \ before it or after it?

dim tmp As New RegistryItem("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\blah\\wibble", False) tmp.Delete("")

Nope

dim tmp As New RegistryItem("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\blah", False) tmp.Delete("wibble")

Nope

I’ve tried:
wibble
\wibble
\wibble\
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\blah\wibble
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\blah\wibble\

The only example on the forum is here, its no use because its wrong (I know you were writing it from memory Wayne, I’m not having a go :slight_smile: ) Name is a String, so it cant have a RegistryItem passed to it.

This is driving me crazy, something seemingly so simple, yet I’m stumped by the documentation :frowning:

Thanks in advance

Great, Delete doesn’t throw an error if it doesn’t have permission to delete the entry.

ARGH, thats 30 mins I wont get back.

Oh FYI if you need to know how to do it:

dim tmp As New RegistryItem("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\blah", False) tmp.Delete("wibble")

What is “whibble” ? A token of sort ?

Try this…

dim tmp As New RegistryItem("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\blah\\wibble", False) tmp.Parent.Delete("wibble")

That should throw an exception if the key doesn’t exist or you don’t have permission to get to it.

FYI - NOT in front of my computer… it’s 4:44 am.

:slight_smile:

wibble is just a filler word for a simulated piece of text, much like blah

https://youtu.be/G2DCExerOsA

33 seconds onwards :slight_smile:

I have a whole dictionary full of daft words, blah, moo, wibble etc. :wink: It saves me spending time thinking of a temporary word.

Thanks Greg, I got there in the end, however its not throwing that error (it would have been a lot quicker of a puzzle if it had), I’m in the middle of writing a feedback about it, I’ll try it on a previous version first though, I’m using a beta version.

<https://xojo.com/issue/47410>