Hello all,

I am trying to get a bunch of sub-keys and values from the registry in vb 2010 and i remember in vb6 this was quite easy. Can anyone share code to help? Or a link where I can go? I've been searching for nearly 8 hours on line and can't find anything I can use. The microsoft sites don't really help and most of the articles I find are for vb 7, or vb 6. Any help would be appreciated.

./x86

tinstaafl,

I know how to read and write to the registry. I'm lost as to how to create the loop needed to iterate through the keys. Do you have any information on this?

The following lists all of the subkeys under HKCU\Software

Dim key As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software")

For Each subkey In key.GetSubKeyNames
    Debug.WriteLine(subkey.ToString)
Next

Reverend Jim,

This is very close to what I'm trying to do. I have been at it for a while trying to mod the code to get it to get the values. Do you think you can help me with this portion? What I'm looking to do is obtain the string value of a key. And, if you can... Do you know any good books that reference the win32 api in vb.net 2010?

./x86

Something like this will iterate through all the values of a specific key:

        Dim key As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software")
        For Each ValueName In key.GetValueNames
            Debug.WriteLine(key.GetValue(ValueName))
        Next
commented: This really helped me. +0

Rock on. I appreciate it. The code works well. I also appreciate the resource.

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.