0

I had it working at one point now it does not want to work. Im checking the registry for a subkey and I know it exists but vb is telling me it doesnt, which is driving me up the wall, this is what I got

Dim regKey1 As RegistryKey
Dim regKeyCheck As RegistryKey

regKeyCheck = Registry.CurrentUser.OpenSubKey("SOFTWARE\Testapp\TestKey", True)
        If Not regKeyCheck Is Nothing Then 'Is somthing
            MsgBox("[SOFTWARE\Testapp\TestKey] does exist!")
            regKey1 = Registry.CurrentUser.OpenSubKey("SOFTWARE\Testapp", True)
            regKey1.DeleteSubKey("TestKey", True)
            regKey1.Close()
            MsgBox("Testkey Removed!")

        ElseIf regKeyCheck Is Nothing Then 'Is not somthing:
            MsgBox("[SOFTWARE\Testapp\TestKey] does not exist!")
        End If

I keep getting a box saying it does not exist even though it does, what am I doing wrong?

1
Contributor
1
Reply
3
Views
7 Years
Discussion Span
Last Post by p@rse
0

I fixed it, though it was registry.currentuser.opensubkey

it had to be set as registry.localmachine.opensubkey

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.