Share via


Visual Basic Reference

Sorted Property

See Also    Example    Applies To

Returns a value indicating whether the elements of a control are automatically sorted alphabetically.

Syntax

object.Sorted

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Return Values

The Sorted property return values are:

Setting Description
True List items are sorted by character code order.
False (Default) List items aren't sorted alphabetically.

Remarks

When this property is True, Visual Basic handles almost all necessary string processing to maintain alphabetic order, including changing the index numbers for items as required by the addition or removal of items.

Note   Using the AddItem method to add an element to a specific location in the list may violate the sort order, and subsequent additions may not be correctly sorted.