Hi does anyone know hoe to implement a move up and down of nodes in a tree view
found what i need in ASP :
http://www.obout.com/t2/eMoveNodes.aspx
no idea how to implent it in VBa
can anybody help
Move nodes up down in a Tree view Contro
-
-
-
Re: Move nodes up down in a Tree view Contro
suppose the only way is to sort the nodes on the Text index since the Index is read only
-
Re: Move nodes up down in a Tree view Contro
If you wish to move a branch up or down the tree then just change the key of the nd.Parent property.
Say you wanted to move a node with key "MoveMe" to be a child of a node with a key "MoveToHere" then the code would be something like:
Hope that helps!
A.
-
Re: Move nodes up down in a Tree view Contro
sry but thats read only
:made this code prob is when a node has childs they do not move up or down with the selected node. Any idea :
Code
Display MoreMy code for Up: Dim i As Integer Dim leaveAlone As Boolean Dim pos As Long Dim Temp As String Dim tvx As MSComctlLib.TreeView Set tvx = tvx_DataNew.Object If tvx.SelectedItem Is Nothing Then Exit Sub End If pos = 1 'i = tvx.SelectedItem.index For i = 0 To tvx.Nodes.Count leaveAlone = False If i = tvx.SelectedItem.Index Then If i = pos Then leaveAlone = True End If pos = pos + 1 If leaveAlone = False Then Temp = tvx.SelectedItem.Previous.Text tvx.Nodes(tvx.SelectedItem.Previous.Index).Text = tvx.Nodes(tvx.SelectedItem.Index).Text tvx.Nodes(tvx.SelectedItem.Index).Text = Temp tvx.SelectedItem.Selected = False tvx.SelectedItem.Previous.Selected = True End If End If Next
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!