Partager via


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]

Property Values

  • 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

See Also

AddItem Method | List Property | ListCount Property | ListItemID Property | RemoveItem Method | RowSource Property | RowSourceType Property

Applies To: ComboBox | ListBox