Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate Treeview from Registry

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
0
0
US
I am trying to populate a treeview that has one set node "Connections" already with entries out of a registry.

I have a registry key say, "Nodes". Its a string. I have different cities in it seperated by a ";". I am splitting each area with the ";" to get a string and populate the treeview node. This works fine.

I want to be able to access another registry key that has servernames in it seperate with a ";" as well. and to be added to the correct node as a child node of that node. I am getting exception errors when on everything I try. code below works to populate the node of "connections" and will display the correct Cities. How can I do what I need to do within the same below loop to pull the server names from the registry?

Code:
Dim regKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\multiRDC")
        Dim MyNodes, word As String
        If Not regKey Is Nothing Then
            MyNodes = My.Computer.Registry.GetValue _
                    ("HKEY_CURRENT_USER\Software\multiRDC\Connections", "Nodes", Nothing)
           
            Dim words As String() = MyNodes.Split(New Char() {";"c})
            For Each word In words
                TreeView1.Nodes("Connections").Nodes.Add(word)
            Next
            

        End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top