TreeView - Urgent!!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi People!

Well, I'm trying to use a tree view by the first time, and I've alrealdy
read a few articles from msdn about working with it. But, this is the
big deal, my tree view will be populated dinamically, then I add a root
knot and inside of it, I add the other knots.
Until I get that, it's ok, but when I need to clean the tree view to
repopulate it, I use this:
TreeView.Nodes.Clear()
The root knot is erased, but the other ones keep still in the tree view,
and when I open the root knot (already repopulated), it shows duplicated
data...

Does anyone know how can I solve that? And clean my hole tree view?!

Thanks.

Marcus Vinícius M. Montezano
..Net Developer
 
Marcus,

i assume you are reusing the root node.

treeview.Nodes.Clear() will only remove the nodes from
the treeview, but it won't remove any nodes from other nodes.

you can either use a new treenode when repopulating, or
you need to remove the nodes from the nodes collection
of the root node before you reuse the root node.

WM_HOPETHISHELPS
thomas woelfer
http://www.die.de/blog
 
Back
Top