I created a private variable
private TreeView currentFullTree;
After that I run through a database and create a nice treeview with parent, child, child nodes. That works fine also. Once the treeview is created I set my private variable to
currentFullTree = treeView1;
That populates perfectly fine and I can even extract each node and re-create the tree exactly how it looked originally from a different function.
Now this is where I'm getting lost. I've created a filter/search function separate from where I created the treeview or re-create the treeview. I want to only display the nodes that match the text provided. Before I perform the search I do a treeView1.Nodes.Clear();
so it looks nice and isn't cluttery.
When I do this, it also empties out my private variable I created! I'm not entirely sure why it is doing this. I was thinking since it is just a TreeView
variable I would be able to store my treeview in there and access it as I please. I'm not sure if it's something silly I'm overlooking, but any help is appreciated.
Thanks, Tim