Get a TreeNode reference to the root node in a TreeView

G

Guest

I'm doing a recursive function that receives a TreeNode object. It's
traversing an XMLDocument and putting the data in a TreeView. The problem is
that to start out, I only have a TreeView object. So to add nodes in the
beginning, I have to call

TreeView.Nodes.Add()

But for everything but the top level, I call

TreeNode.Nodes.Add()

It would make my life much easier if I could get a TreeNode reference to the
root node in my TreeView. Is this possible or do I have to completely redo my
logic?
 
G

Guest

I got around this by using a new TreeNode and after I populated the TreeNode
I added it's Nodes to TreeNode.Nodes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top