This is a migrated thread and some comments may be shown as answers.

Exception when re-adding nodes

1 Answer 98 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 29 Jun 2012, 02:01 PM
The following code will reproduce the exception:

RadTreeView tree = new RadTreeView();
tree.Name = "tree";
       
RadTreeNode[] nodes = new RadTreeNode[5];
for (int i = 0; i < nodes.Length; ++i)
  nodes[i] = new RadTreeNode(i.ToString());
 
tree.Nodes.AddRange(nodes);
tree.Nodes.Clear();
tree.Nodes.AddRange(nodes);

It seems that I would need to call "Remove" on each node before adding them back to the tree. But, since I'm adding them to the same TreeView, should an exception still be thrown?

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 04 Jul 2012, 11:29 AM
Hello Liru,

Thank you for writing.

Indeed, I can confirm that the exception is thrown in this case. I am logging this in PITS and we will address it accordingly. Feel free to subscribe for its status updates at the following link:  http://www.telerik.com/support/pits.aspx#/public/winforms/11737.

As workaround, you can call the Remove method the each node, as you mentioned.

Thank you for this report. Your Telerik points have been updated accordingly.
 
All the best,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Treeview
Asked by
Michael
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or