1. We can use the SelectedNode to get the current selected node
2. We use the NextNode Property to retrieve the next node
3. We set the NextNode to the SelectedNode, so that the "NextNode" will be
the current selected node.
e.,g.
Me.TreeView1.Se lectedNode = Me.TreeView1.Se lectedNode.Next Node
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks for the prompt reply.
My Nodes are sub nodes of Node(0) so
.Nodes(0).NextN ode
Did not work for me (it jumps to Node(1) not to the next sub node)
2)
.NextNode does not check the end of nodes. so what I'm using is:
With stvView.trvView s
If .Nodes(0).LastN ode.Index = .SelectedNode.I ndex Then
.SelectedNode = .Nodes(0).Nodes (0)
Else
.SelectedNode = .Nodes(0).Nodes (.SelectedNode. Index + 1)
End If
End With
Sure that will work, but you will screw up when you get to the end of a
branch and want to come back down the other side (if you see what I mean).
A proper traversal of a tree, in order, requires a stack (or recursion).
Your code below will traverse from the current position to the nearest leaf.
"adh" <adh@devx.com > wrote in message
news:e44EnLJqFH A.2724@TK2MSFTN GP10.phx.gbl...[color=blue]
> Thanks for the prompt reply.
> My Nodes are sub nodes of Node(0) so
> Nodes(0).NextNo de
> Did not work for me (it jumps to Node(1) not to the next sub node)
> 2)
> NextNode does not check the end of nodes. so what I'm using is:
> With stvView.trvView s
> If .Nodes(0).LastN ode.Index = .SelectedNode.I ndex Then
> .SelectedNode = .Nodes(0).Nodes (0)
> Else
> .SelectedNode = .Nodes(0).Nodes (.SelectedNode. Index + 1)
> End If
> End With
>
> ????
>
> Thanks, adh
>
> *** Sent via Developersdex http://www.developersdex.com ***[/color]
Comment