IndexToItemID Method

Returns an ItemID for a given Index number.

Control.IndexToItemID(nIndex)

Parameters

  • nIndex
    Specifies a number that represents the position that an item is displayed in a control.

Return Value

The following table lists the return values for IndexToItemID Method.

Return value

Condition

nItemID

Returns an ItemID for a given Index number.

Remarks

Applies To: ComboBox | ListBox

Each item added to a ComboBox or ListBox has two identification numbers assigned to it:

  • The nItemID, a unique identification number.

  • The nIndex, an integer corresponding to the order in which items are displayed by the control: The first item in the list corresponds to nIndex = 1.

Initially, as items are added to the control, these two numbers are identical. But as items are sorted, removed, and added, these numbers are no longer identical.

Use the IndexToItemID method to return the nItemID number for a particular item in the control when you know its nIndex number.

See Also

Reference

AddItem Method (Visual FoxPro)

AddListItem Method

ItemIDToIndex Method

Other Resources

Methods (Visual FoxPro)