I have a treeview, tv, and a button on a form. In the button’s click event I have the following code:
var root = new TreeNode();
root.Text = “Root Node”;
for (int i = 1; i <= 5; i++)
var node = new TreeNode();
node.Text = “Node ” + i.ToString();
I would expect that every time I click the button I get the same treeview, since the first line of my code clears the treeview. However, a new “Root Node” is added every time, and the treeview keeps extending. Am I missing something?
Hi Alex & Tiago,
build 1.2.71 is now available including a fix for WJ-7669.
Can you guys please retest your applications ? Thanks !
All good with Nodes.Clear() now! Thanks.
To be honest I was suspecting they might be related, since after tv.Nodes.Clear() the count was zero but of course the treeview had all the previous nodes. But I wasn’t sure. After all it was easy to reproduce! 🙂
I think you found the issue I was referring to on https://wisej.com/support/question/treeview-wrong-node-count.
I could reproduce the problem and logged WJ-7669 for it.