473,474 Members | 1,310 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.NET TreeView move to next node

adh
How do you move by program to the next node of a treeview (NextButton)?
Thanks
Nov 21 '05 #1
5 13685
Hi

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.SelectedNode = Me.TreeView1.SelectedNode.NextNode
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.

Nov 21 '05 #2
adh
Thanks for the prompt reply.
My Nodes are sub nodes of Node(0) so
.Nodes(0).NextNode
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.trvViews
If .Nodes(0).LastNode.Index = .SelectedNode.Index 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 ***
Nov 21 '05 #3
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" <ad*@devx.com> wrote in message
news:e4**************@TK2MSFTNGP10.phx.gbl...
Thanks for the prompt reply.
My Nodes are sub nodes of Node(0) so
Nodes(0).NextNode
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.trvViews
If .Nodes(0).LastNode.Index = .SelectedNode.Index 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 ***

Nov 21 '05 #4
adh
OK. Got it.
Thanks, adh

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #5
Hi

I agree with Robin's suggestion.
If you wants to traverse a tree strcture of treenodes, you need to use
recursion or stack.

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.

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: someone | last post by:
I want to write code to move to the next node in a TreeView. The code will behave similar to when the user presses down arrow. Thanks.
2
by: Anand Ganesh | last post by:
Hi All, How to Implement Move Next, Move Previous, Last Record and First Record in a DataGrid Control ? Is there any standard tool available in the tool box button? Thanks for your time. ...
4
by: praveen | last post by:
I have a form with treeview control loaded from xml document,text box, two buttons named "Find" and "FindNext" and my treeview which looks like below. Details |__ policy status |__ created by...
2
by: Pucca | last post by:
How do I make the TreeView control's node text (or label) editable when user click twice on it? (Not double click). It's like the explorer on our computer drives. The directory tree label...
55
by: indhu | last post by:
HI all one sequence has many panels. when i select combo it displays all the fields but panel has more rows. i want to view that also. how to do that? move next and previous commds are there...
1
by: rampm2007 | last post by:
Hi, I am using the XmlTextReader along XmlValidatingReader for parsing the XML file. Becuase of the foreign characters sometimes I get the "There is an invalid character in the given encoding"...
3
by: dianaj86 | last post by:
I have multiple dropdownlists each one filled with values from a specific column in the table. Also I have multiple textboxes corresponding to dropdownlists. For example, when I select an item from...
0
JaneDoe
by: JaneDoe | last post by:
hi I am writing a classic asp page. I want to move a node with children to a cookie, but cannot figure out how to put in the cookie. Then I want to read the cookie and re-use the xml. below is my...
2
by: Jeff | last post by:
Lets say we have this: <h4 onclick="findFollowingNode()">Find next node</h4> <div>I want to get this node, (the div wrapper) so I can toggle visibility</div> It's been a while since I've...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.