Is it possible to change order of nodes in treeview?
-
Is it possible to change the order of nodes in treeview control? I wanted to move a node which don't have any child node to one step above. am using c# and winforms dotnetframework is 2.0
Remove the TreeNode in question from one TreeNodeCollection and put it in another or insert it back into the TreeNodeCollection at a different spot, depending on what "one step above" means. Also look at TreeView.Nodes and TreeNode.Nodes.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
Is it possible to change the order of nodes in treeview control? I wanted to move a node which don't have any child node to one step above. am using c# and winforms dotnetframework is 2.0
TreeNode parent = myNode;
TreeNode child = parent.Nodes[0];// remove node
child.Remove();// add it one level above
parent.Parent.Nodes.Add(child);// re-add the former parent node
child.Nodes.Add(parent);This statement is false.