ItemData Properties

Returns or sets a specific number for each item in a DCombo list.  Available only at run time.


Syntax

object.RLItemData(index) [= number ]
object.LLItemData(index) [= number ]

The syntax of the ItemData properties has these parts:

PartDescription
objectA DCombo control.
index  The index of a specific item in the list.
number  The number to be associated with the specified item.

Remarks

The ItemData properties are an array of long integer values with the same number of items as a control's List property. You can use the numbers associated with each item to identify the items. For example, you can use an employee's identification number to identify each employee name in a DCombo control list. When you fill the list, also fill the corresponding elements in the ItemData array with the employee numbers.

The ItemData property is often used as an index for an array of data structures associated with items in a DCombo control list.

Note: When you insert an item into a list with an AddItem method, an item is automatically inserted in the ItemData array as well. However, the value isn't reinitialized to zero; it retains the value that was in that position before you added the item to the list. When you use an ItemData property, be sure to set its value when adding new items to a list.  In sorted lists use the appropriate NewIndex property to retrieve the correct index as in the following example.

Private Sub Form_Load()
   'Fill DCombo1 and ItemData array with
   'corresponding items in sorted order.
   DCombo1.RLAddItem "Joan Collins"
   DCombo1.RLItemData(DCombo1.RLNewIndex) = 48219
   DCombo1.RLAddItem "Carl Shultz"
   DCombo1.RLItemData(DCombo1.RLNewIndex) = 51487
   DCombo1.RLAddItem "Marco Sanchez"
   DCombo1.RLItemData(DCombo1.RLNewIndex) = 54286
   DCombo1.RLAddItem "Dianna Morgan"
   DCombo1.RLItemData(DCombo1.RLNewIndex) = 22393
End Sub

Data Type

index  Integer
number  Long