Share via


IndexToItemID Method

Returns an index for a given item ID.

 [nItemID =] Control.IndexToItemID(nIndex)

Parameters

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

Remarks

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

AddItem Method | AddListItem Method | ItemIDToIndex Method

Applies To: ComboBox | ListBox