Partager via


ListIndex Property (Visual FoxPro)

Specifies the index number of the selected item in a ComboBox or ListBox control. Not available at design time; read/write at run time.

Control.ListIndex[ = nIndex]

Return Value

  • nIndex
    The settings for the ListIndex property are:

    Setting

    Description

    0

    (Default) Indicates no items selected. For a combo box, this means that the user has entered a value not in the list.

    1 ... ListCount   

    The index of the selected item.

Remarks

Applies To: ComboBox Control | ListBox Control

The following displays the string of the selected item.

? List(MyList.ListIndex)

You can return the same value by using the control's Value property.

Setting the MultiSelect property of a ListBox to .T. allows more than one item to be selected. In this case, the ListIndex will contain the index of the item that currently has the selection border.

See Also

Reference

AddItem Method (Visual FoxPro)

AddListItem Method

IndexToItemID Method

ItemIDToIndex Method

List Property

ListCount Property

ListItem Property

RemoveItem Method

Value Property

Other Resources

Properties (Visual FoxPro)