Hi,
I have a Winforms 2.0 project that I'm working on that involves populating a treeview control from data contained in a fairly large dataset that has to be refreshed periodically.
I have no problems populating the treeview nodes initially, but am somewhat flustered as to how I should go about keeping the treeview control current with the dataset.
After the dataset has been refreshed, I can, of course, clear the treeview nodes and start building again, but that is not the desired solution as it blanks out the nodes and then builds them again, thus losing the state of all nodes in the treeview control (nodes that have been collapsed/expanded by the user); not to mention how disruptive this is to the visual experience.
What I would like to do is to add all new nodes to the treeview control and remove all of the obsolete nodes. It's simple enough to add the new nodes by first finding any nodes corresponding to data in the dataset, but how do I remove the nodes that are not in the dataset in a timely and efficient way?
How does everyone else do this?
Any suggestions would be greatly appreciated.
Thanks,
Charlie