This documentation is archived and is not being maintained.

Visual Basic: Windows Controls

Visual Studio 6.0

Expanded Property

See Also    Example    Applies To

Returns or sets a value that determines whether a Node object in a TreeView control is currently expanded or collapsed.


object.Expanded[= boolean]

The Expanded property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
boolean A Boolean expression that specifies whether the node is expanded or collapsed.

The settings for boolean are:

Setting Description
True The Node is currently expanded.
False The Node is currently collapsed.


You can use the Expanded property to programmatically expand a Node object. The following code has the same effect as double-clicking the first Node:

TreeView1.Nodes(1).Expanded = True

When a Node object is expanded, the Expand event is generated.

If a Node object has no child nodes, the property value is ignored.