TreeView node insertion in between existing nodes

  • Thread starter Thread starter fishware
  • Start date Start date
F

fishware

I've got a treeview created by

TreeNode node = treeView1.Nodes.Add("one");
node.Nodes.Add("three");

looks like:

one
-> three

How do I insert "two" between one and three (one becomes the parent of
two, which becomes the parent of three, and the parent-child
relationship between one and three is broken).

one
-> two
-> three


thanks.
 
[...]
How do I insert "two" between one and three (one becomes the parent of
two, which becomes the parent of three, and the parent-child
relationship between one and three is broken).

Remove "three" from the nodes of "one", add it to the nodes of "two" and
add "two" to the nodes of "one".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top