Sorted (TreeView)

Returns or sets a value that determines whether the child nodes of a Node object are sorted alphabetically.

Returns or sets a value that determines whether the root level nodes of a TreeView control are sorted alphabetically.

Syntax

object.Sorted [ = boolean]

The parts of the Sorted property syntax are described in the following table.

Part Description
object An object expression that evaluates to an object.
boolean A Boolean expression specifying whether the Node objects are sorted, as described in Settings.

Settings

The Sorted property settings are described in the following table.

Setting Description
True The Node objects are sorted alphabetically by their Text property. Node objects whose Text property begins with a number are sorted as strings, with the first digit determining the initial position in the sort, and subsequent digits determining sub-sorting.
False The Node objects are not sorted.

Remarks

The Sorted property can be used in two ways: first, to sort the Node objects at the root (top) level of a TreeView control and, second, to sort the immediate children of any individual Node object.

Setting the Sorted property to True sorts the current Nodes collection only. When you add new Node objects to a TreeView control, you must set the Sorted property to True again to sort the added Node objects.