The index of the integer value within the collection.
object.IndexOf(aValue)
Part | Attribute | Type | Description |
---|---|---|---|
object |
Required | The object always implements the
ISIntCollection interface |
|
aValue |
In, Required | int |
The integer value |
int
Fill in the collection with randomized integer values, display their count and indices within the collection.
Dim aIntColl
Dim aResultCount
Dim aValue
Dim aIndex
Dim aMessage
Set aIntColl = Profile.CreateIntCollection
aIntColl.Add 12
aIntColl.Add 11
aIntColl.Add 22
aIntColl.Add 48
aIntColl.Add 37
aIntColl.Add 54
aIntColl.Add 92
Randomize
aResultCount = 3
for i = 0 to aResultCount - 1
aIndex = Int(aIntColl.Count * Rnd)
aValue = aIntColl.Item(aIndex)
aMessage = aMessage & vbNewLine & "IntValue(#" & aIntColl.IndexOf(aValue) & ") = " & aValue
next
Profile.MsgBox(aMessage)