次の方法で共有


ItemIDToIndex Method

Returns the value of nIndex, the position of an item in a control's list.

 [nIndex =]Control.ItemIDToIndex(nItemID)

Parameters

  • nItemID
    The unique identification number associated with that item.

Remarks

Each item added to a combo box or list box has two 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 ItemIDToIndex method to retrieve the nIndex number for a particular item in the control's list when you know its nItemID number.

See Also

AddItem Method | AddListItem Method | IndexToItemID Method | ListItemID Property | List Property | ListCount Property

Applies To: ComboBox | ListBox