Uses an index 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.ItemData(nIndex)[ = nData]
Settings
nIndex
Specifies the index of the item to store or retrieve. The nIndex corresponds to the display order of the items in the list.
nData
The number to store or retrieve from the ItemData list.
Remarks
Use the ItemData 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 in the list. 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 ItemData 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 ItemData 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 ItemData property, be sure to set each element's value when adding new items to a list.
Also note that the value of the ItemData property is only accurate for combo boxes or list boxes containing less than 60 items.