Exception when re-adding nodes

2 posts, 1 answers
  1. Michael
    Michael avatar
    4 posts
    Member since:
    Dec 2012

    Posted 29 Jun 2012 Link to this post

    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?
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 04 Jul 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top