Sorted Property

Applies To   See Also

Specifies whether the items in the list portion of a ComboBox or ListBox control are automatically sorted alphabetically. Available at design time and run time.

Syntax

[Form.]Control.Sorted[= lExpr]

Settings

lExpr

The settings for the Sorted property are as follows:

Setting Description
True (.T.) List items are sorted alphabetically (case-sensitive). Visual FoxPro handles almost all necessary string processing to maintain alphabetic order, including changing the index numbers for items as required when items are added or removed from the list.
False (.F.) (Default) List items are not sorted alphabetically.

Remarks

The Sorted property is only available if the RowSourceType property is set to 0 (None) or 1 (Value).

Note that once the items are sort alphabetically, setting the Sorted property to false (.F.) doesn’t restore the items to their original order. To restore the original order, set the control’s RowSource property to itself, as in the following example:

MyForm.MyCombo1.Rowsource = MyForm.MyCombo1.Rowsource