Remarks

The Expand method expands the current TreeNode down to the next level of nodes.

Note The state of a TreeNode is persisted. For example, if the next level of child nodes was not collapsed previously, when the Expand method is called, the child nodes appear in their previously expanded state.

Example

[Visual Basic, C#, C++] The following example toggles the selected node when a button is clicked. If the selected node is collapsed, it is expanded, if it is expanded by calling the Expand method, it is collapsed by calling the Collapse method. This example assumes you have a Form with a TreeView control that has at least one TreeNode object with at least one child TreeNode.