Refreshing a TreeView

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hi

How can i refresh a treeview when it is expanded to remove / add nodes that
have been deleted / added in a previous activity, leaving the view as
before, but with the new node structure dislayed.

Tony
 
Hey Tony
Well there is a refresh function for treeviews. You could try hiding it,
refresh then show. It may be a little simple for what you are looking for
though.

Danielle
 
Hi Tony - Here is what I usually do:

Whenever an object is added, which needs to be displayed in the tree I have
a Hashtable which maps the object to the corresponding TreeNode. When I need
to do an update to a particular object (and reflect this in the tree) I can
use this Hashtable to locate the TreeNode involved, and do the change to
just that node or the nodes collection of children.

When you add/delete an object you need a way to locate the parent TreeNode
of the object first, and do the update to this parent TreeNode.

Using this approach you should not have to redo the entire tree view.

Hope this helps

Regards
Thomas Koch
 
Back
Top