Hello there,
How can i add a node in a certian place in a treeView control?
Thanks ahead
Hello there,
How can i add a node in a certian place in a treeView control?
Thanks ahead
Know the answer? Post it. Somebody with the same question will find it here.
Mike GoldRank #50 · 30.6K pointsPosted Aug 18, 2007, 8:22 PM EDT
Add will add at the end of the Nodes collection,
The Insert method will add at a particular index in the Nodes collection
e.g.
myTreeView.Nodes.Insert(3, myTreeNode);
kobi shaal16 pointsPosted Aug 18, 2007, 11:31 PM EDT
how can i found the index which represnt my needed node?
Thanks
Mike GoldRank #50 · 30.6K pointsPosted Aug 19, 2007, 9:21 AM EDT
I don't really understand the question.
you could loop through the nodes under the parent and when you find the node you need to insert after or before, use the Insert
kobi shaal16 pointsPosted Aug 19, 2007, 9:55 AM EDT
i did something like you said :
until now im using a recursive function which travel over my tree and when the function found the needed function it reutun the founded node.
now to this node i need to add a node so it will like a child to the founed node
how can i do it?
Thanks again
Mike GoldRank #50 · 30.6K pointsPosted Aug 20, 2007, 8:57 AM EDT
foundNode.ChildNodes.Add
or
foundNode.ChildNodes.Insert
depending on where you want to put the child node