Visual Basic: Windows Controls

Node Object, Nodes Collection

See Also    Example    Properties    Methods    Events

  • A Node object is an item in a TreeView control that can contain images and text.

  • A Nodes collection contains one or more Node objects.

Syntax

treeview.Nodes

treeview.Nodes.Item(index)

The syntax lines above refer to the collection and to individual elements in the collection, respectively, according to standard collection syntax.

The Node object and Nodes collection syntax have these parts:

Part Description
treeview An object expression that evaluates to a TreeView control.
index Either an integer or string that uniquely identifies a member of a Nodes collection. The integer is the value of the Index property; the string is the value of the Key property.

Remarks

Nodes can contain both text and pictures. However, to use pictures, you must associate an ImageList control using the ImageList property.

Pictures can change depending on the state of the node; for example, a selected node can have a different picture from an unselected node if you set the SelectedImage property to an image from the associated ImageList.

The Visible property of the Node object is read-only at run time.