View Single Post
  #2 (permalink)  
Old 07-01-2009, 10:25 AM
grmbl's Avatar
grmbl grmbl is offline
VB.NET Forum Enthusiast
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Jun 2009
Location: Belgium
Age: 27
Posts: 32
Reputation: 12
grmbl is on a distinguished programming path ahead
Default

I allready found a solution and thought it would be a good idea to post it
here:

Code:
Dim root As TreeNode
        root = New TreeNode("This computer")
        root.ImageIndex = 5
        root.SelectedImageIndex = 5

        'HKEY_CLASSES_ROOT
        Dim rootnode As TreeNode
        rootnode = New TreeNode(Microsoft.Win32.Registry.ClassesRoot.Name.ToString)
        rootnode.ImageIndex = 4
        rootnode.SelectedImageIndex = 4
        Dim rootsubkeys() As String = Microsoft.Win32.Registry.ClassesRoot.GetSubKeyNames()
        For Each k As String In rootsubkeys
            Dim node As TreeNode
            node = New TreeNode(k)
            node.ImageIndex = 3
            node.SelectedImageIndex = 3
            Dim subkeys() As String = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(k).GetSubKeyNames()
            For Each subkeyskey As String In subkeys
                node.Nodes.Add(subkeyskey, subkeyskey, 0, 3)
            Next
            rootnode.Nodes.Add(node)
        Next
        root.Nodes.Add(rootnode)

tReg.Nodes.Add(root)

        tReg.Nodes(0).ExpandAll()
This can be used to list the whole registry.
The variables are "Microsoft.Win32.Registry.ClassesRoot" and the imageindices...

Hope this helps someone in the future!
__________________
"The world is coming to an end... SAVE YOUR BUFFERS !"
Reply With Quote