ItemIDData Property

Applies To   See Also

Uses a unique identification number to reference a one-dimensional array that contains the same number of items as a ComboBox or ListBox control's List property setting. Not available at design time; read-write at run time.

Syntax

Control.ItemIDData(nItemID)[ = nData]

Settings

nItemID

Specifies the item ID, a unique identification number.

nData

The number to store or retrieve from the ItemIDData list.

Remarks

Use the ItemIDData property to associate a specific number with each item in a combo box or list box. You can then use these numbers in code to identify the items. For example, you can use an identification number to identify each employee name in a list box. When you fill the list box, also fill the corresponding elements in the ItemIDData array with the employee numbers.

Note   When you insert an item into a list with the AddItem method, an item is automatically allocated in the ItemIDData array as well. However, the value is not initialized; it retains the value that was in that position before you added the item to the list. When you use the ItemIDData property, be sure to set each element's value when adding new items to a list. This is the same array that is accessed by the ItemData Property.