I'm working with the treeview control and use this procedure to move the nodes within the treeview:
Private Sub MoveNode(tvw As TreeView, nodX As Node, Direction As String)
Dim nodN As Node
Dim strKey As String
Dim AntKey As String
Dim ActKey As String
Select Case Direction
If Not nodX.Previous Is Nothing Then
Set nodN = .Nodes.Add(nodX.Previous, tvwPrevious, , nodX.Text)
If Not nodX.Next Is Nothing Then
Set nodN = .Nodes.Add(nodX.Next, tvwNext, , nodX.Text)
nodN.Selected = True
If nodX.Children <> 0 Then
GetChildren tvw, nodX, nodN
strKey = nodX.Key
Set nodX = Nothing
nodN.Key = strKey
The problem is that I want to know the actual node Index once I move it. By example, I have a treeview control with one parent and three children nodes. I use the function MoveNode() and move the node number 3 (index = 3) to the first position, but it still have the index = 3, when the value that I need is 1, and the second node the value = 2 and the third = 3, and so on.
Could anyone help me!!!!
Thanks in advance.