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:
  1. Private Sub mapNodes(ByVal myNode As TreeNode)
  2.  
  3.         Dim subNode As TreeNode
  4.  
  5.         'Are we at a root node?
  6.         If myNode.Tag = "root" Then
  7.             nodeMap = "root:"
  8.         End If
  9.  
  10.         'Iterate through each sub-node.
  11.         For Each subNode In myNode.Nodes
  12.             nodeMap += subNode.Text & ":"
  13.  
  14.             'If this node has children, recurse through them...
  15.             If subNode.GetNodeCount(False) > 0 Then
  16.                 'Stuck here!!
  17.             End If
  18.         Next
  19.  
  20.     End Sub