I am working on a small project that uses the treeview control in .net 2003. I have a tree view that I am sending to a sub in order to iterate through the nodes.

Public Sub test (ByVal inTreeView as Tree View)

But, the thing I want to do with the inTreeView requires me to expand all the nodes before I iterate. The problem is that when the sub is complete, the original tree view on my form ends up with all of the nodes expanded I had hoped that sending it to my sub "ByVal" would make a copy that I could mess around with without effecting the original. I also tried creating a new treeview and assigning the inTreeView to it, then doing my stuff:

dim TestTree as new TreeView
TestTree = inTreeView

but no matter what the source treeview always gets expanded when I do an expandall TestTree.ExpandAll()

Can anyone tell me how to get a duplicate of a treeview in a way that I can expandall and not effect the source object?

Thanks
cas