Visual Basic: Windows Controls

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.

Syntax

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.

Remarks

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.