ISIntCollection.Delete

Description

This function deletes the integer value within the collection.

Syntax

object.Delete aIndex

Part Attribute Type Description
object Required
The object always implements the ISIntCollection interface
aIndex In, Required
int
The index of the integer value in the collection to be deleted

Example

Display the number of the integer values within the collection before and after deleting the first one.

Dim aItemCount
Dim aIntColl
Dim aValue
Dim aResultCount
Dim aUsedIndices
Dim aIndex
Dim aMessage

aItemCount = 70

Set aIntColl = Profile.CreateIntCollection

for i = 1 to aItemCount
  aValue = i * 10
  aIntColl.Add(aValue)
next

Randomize

aResultCount = 10
set aUsedIndices = Profile.CreateIntCollection
aMessage = aMessage & vbNewLine &_
  "The number of the integer values in the collection is " & aIntColl.Count
do
  aIndex = Int(aItemCount * Rnd)
  aUsedIndices.AddSortedDistinct(aIndex) 
loop until aUsedIndices.Count = aResultCount   

for i = 0 to aUsedIndices.Count - 1
  aIndex = aUsedIndices.Item(i)
  aValue = aIntColl.Item(aIndex) 

  aMessage = aMessage & vbNewLine & "IntValue(" & aIndex & ") = " & aValue  
next 
aIntColl.Delete(0)

aMessage = aMessage & vbNewLine & "The number of the integer values in the" &_
  "collection after excluding the first one is is " & " " & aIntColl.Count  

Profile.MsgBox(aMessage)
Note:

Version information

Added in v7.8.0