Link to home
Start Free TrialLog in
Avatar of michellechan57
michellechan57

asked on

TreeView Clear and Clone Question

I have trouble clearing nodes in a TreeView control and re-populating it again in a C#2.0 winform app.

private void Reset(TreeView treeView)
{
    treeView.Nodes.Clear();
    treeView.Nodes.Add("Node0", "Node0");
    treeView.Nodes[0] = (TreeNode) treeViewMaster.Nodes[0].Clone();
    treeView.Refresh();
}

Problem is, there is one extra node "Node0" appearing below treeView.Nodes[0] each time the function is called.
What is the proper way to clear the treeview and clone an exact copy from another?
ASKER CERTIFIED SOLUTION
Avatar of ennixo
ennixo
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial