Sorted Property

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.

 [Form.]Control.Sorted[= lExpr]

Return Value

  • 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

Applies To: ComboBox | ListBox

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

See Also

Reference

AddItem Method (Visual FoxPro)

List Property

ListCount Property

ListItemID Property

RemoveItem Method

RowSource Property

RowSourceType Property

Other Resources

Properties (Visual FoxPro)

Language Reference (Visual FoxPro)