Selected Property

Example   Applies To   See Also

Specifies whether an item is selected in a combo box or list box. Not available at design time; read-write at run time.

Syntax

[Form.]Control.Selected(nIndex)[= lExpr]

Settings

nIndex

Specifies the index of an item in a combo box or list box.

lExpr

The settings for the Selected property are:

Setting Description
True (.T.) The item is selected.
False (.F.) (Default) The item isn't selected.

Remarks

The Selected property is particularly useful where users can make multiple selections. You can quickly check which items in a list are selected. You can also use this property to select or deselect items in a list from within a program. To check whether the third item in a list box is selected, issue the following:

IF MyList.Selected(3)
  WAIT WINDOW "It's selected!"
ELSE
  WAIT WINDOW "It's not!"
ENDIF