TreeView Control

Expanding Items

If you want to make sure a node is visible, you can use the EnsureVisible method:

TreeView1.Nodes(21).EnsureVisible

This will expand any items, and scroll as required to ensure that the item specified is visible.

If a node has child items, a + appears next to it. The user can press this to show the child items. When the user expands an node, the Expand event occurs. Once the node has been expanded, a - appears next to it. When this is pressed, the child items are hidden, and the Collapse event occurs

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay