Share via


SelectedID Property

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

Control.SelectedID(nItemID)[= lExpr]

Return Value

  • nItemID
    Specifies the item ID of an item in a combo box or ListBox.

  • lExpr
    The settings for the SelectedID property are:

    Setting

    Description

    True (.T.)

    The item is selected.

    False (.F.)

    (Default) The item isn't selected.

Remarks

Applies To: ComboBox | ListBox

Setting the SelectedID property on a Listbox control also sets the ListItemID property, and fires the ProgrammaticChange event.

The SelectedID 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 using code. To check whether the third item in a ListBox is selected, issue the following:

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

See Also

Reference

AddItem Method (Visual FoxPro)

Clear Method

List Property

ListCount Property

ListItemID Property

MultiSelect Property (Visual FoxPro)

NewItemID Property

RemoveItem Method

RemoveListItem Method

Selected Property

TopItemID Property

Other Resources

Properties (Visual FoxPro)