I have a treeview that displays certain information. If specific information needs to be flagged, the node is coloured in red. The user can view a datagrid displaying all information pertaining to the red nodes, on a button click event.
Each datagridrow has a checkbox that can be used to toggle the flag on the treenode, which updates the sql database flag. What I also want to do is toggle the colour of the node (ie, the visual flag), back to black. I know how to do this using recursion, however the treeview may grow to hold 100’s or 1000’s of nodes, and I am worried about efficiency. Is there any other way to interact with a specific node, without having to recurse?
Thanks.
In General , if your tree exhibits some property like Binary tree or BST , you can reduce the time but that is not the case with winforms treeview scenarios most of the time.
so there is no other way to reach to the actual node but to recurse the tree.
But you can make use of asynchronous programming to search on the secondary thread.