Deep copying of tree view nodes.

Posted by Kanags.Net on Stack Overflow See other posts from Stack Overflow or by Kanags.Net
Published on 2010-03-31T06:35:46Z Indexed on 2010/03/31 6:43 UTC
Read the original article Hit count: 208

Filed under:

I'm trying to copy a treeview nodes to treenodecollection for some other processing. When i execute the treeview.nodes.clear() in the next line, my treenodecollection is becoming null. Can you please tell me how to copy the treeview nodes to treenodecollection and keep the copies of the nodes even after calling Clear method of actual tree view nodes?

TreeNodeCollection tnc = null;
private TypeIn()
{
      tnc = treeView1.Nodes;
      treeView1.Nodes.Clear();
      //Now my tnc becomes null, but I want the tnc for future use.
}

© Stack Overflow or respective owner

Related posts about c#