How to move to next node in TreeView?

S

someone

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.
 
C

Chris Hornberger

Will that auto-scroll to the out of view items?

If it doesn't, you can hit the treeView.Nodes with an index and set
that one to ".EnsureVisible=true" (or is that a method call now?)
 
S

someone

Thanks a lot. I replaced my 20 or so lines of code, which even had a bug
because it was not recursively looking at parent nodes.
 
S

someone

NextVisibleNode does not scroll to out of view nodes. Here is part of my
code:
// Make sure the children nodes at the currently selected node are visible
tvwFolders.SelectedNode.Expand();

// Select the next node in the TreeView
tvwFolders.SelectedNode = tvwFolders.SelectedNode.NextVisibleNode;

Thanks for the additional tips.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top