Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeView: Reusing child node with different parent. 1

Status
Not open for further replies.

hilmibakhari

Technical User
Jun 30, 2003
2
MY
Hi,

I'm creating a preview of a product structure known as Bill of Materials (BOM). In BOM, often a same child is assigned to different multiple parents. I'm intending to use treeview control so that the structure will be clearer.

My problem is that the function that i created to recursively search and rearrange the child node in a treeview will cause exception because i'm trying to place the same child in more than one place.

Please throw some light into this.

Thanks in advance..
 
Use the TreeNode.Clone method to produce a copy of the node that appears in the tree view at more than one place:
Code:
Dim tn As TreeNode = CType(tv.Nodes(0).Clone, TreeNode)
You can then attach the new treenode to the treeview at the required place.

Be aware that cloning a node will also clone all child nodes attached to the cloned node.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top