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?

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

it had to be set as registry.localmachine.opensubkey

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.