J
John Rogers
How do you move a selected node up or down a treeview?
Not by drag and drop but by clicking a button to move the
node up or down.
I tried the following, but my tree gets all messed up after I move
the first node.
TreeNode sourceNode = treeView.SelectedNode;
if (sourceNode.Parent == null)
return;
treeView.Nodes.Remove(sourceNode);
treeView.Nodes.Insert(sourceNode.Index + 1, sourceNode);
Thanks
John
Not by drag and drop but by clicking a button to move the
node up or down.
I tried the following, but my tree gets all messed up after I move
the first node.
TreeNode sourceNode = treeView.SelectedNode;
if (sourceNode.Parent == null)
return;
treeView.Nodes.Remove(sourceNode);
treeView.Nodes.Insert(sourceNode.Index + 1, sourceNode);
Thanks
John