|
-
Sep 9th, 2004, 09:43 AM
#1
Thread Starter
Hyperactive Member
Recursively Map Tree Node Structure
Hi,
I'm trying to map a tree-node structure and have been racking my brains for the last couple of hours and need some help.
I want to output the structure of a tree view including it's sub-nodes to a string, delimited by a colon.
I have got the code working if the first child nodes do not have any sub-nodes (i.e: root/subnode)
But if any of the subnodes have children, I get stuck!
Please help!
Here's what I have so far.....
VB Code:
Private Sub mapNodes(ByVal myNode As TreeNode)
Dim subNode As TreeNode
'Are we at a root node?
If myNode.Tag = "root" Then
nodeMap = "root:"
End If
'Iterate through each sub-node.
For Each subNode In myNode.Nodes
nodeMap += subNode.Text & ":"
'If this node has children, recurse through them...
If subNode.GetNodeCount(False) > 0 Then
'Stuck here!!
End If
Next
End Sub
"I'm Brian and so is my Wife"
-
Sep 9th, 2004, 10:33 AM
#2
Thread Starter
Hyperactive Member
Re: Recursively Map Tree Node Structure
Just needed to call the function again!
It's been a long day!!!!
VB Code:
'If this node has children, recurse through them...
If subNode.GetNodeCount(False) > 0 Then
mapNodes(subNode)
End If
Now I just need to find some way of organising the string so that I can accurately re-populate an empty tree-view with the structure. (this string is held in the registry and will be used to re-populate a tree view at runtime).
"I'm Brian and so is my Wife"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|