Sorted Property (TreeView, Node)

Purpose

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

TreeView.Sorted [ = boolean]

Node.Sorted [ = boolean]

Description

When set to 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. If False, the Node objects are not sorted.

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.

Example

Ocx TreeView tv1 = "", 250, 10, 230, 200

Dim node As Node

Set node = tv1.Nodes.Add(,,,"Parent Node")

node.Sorted = True

tv1.Sorted = True ' Top level Node objects are sorted.

See Also

TreeView, Nodes, Node

{Created by Sjouke Hamstra; Last updated: 12/05/14 by James Gaite}