Count Method

Gets the number of elements actually contained in the ArrayList object.

Syntax

Object.Count()

Arguments - Object: Required. Always the name of ArrayList object.

Returns

Number of elements actually contained in the ArrayList object

Remarks

The following example illustrates the use of the Count method.

Example 1:


'Create ArrayList Object
Dim Obj
Dim Cnt
Set Obj = CreateObject("System.Collections.ArrayList")

'Add Elements to the end of the ArrayList Object
Dim Index
Index = Obj.Add(10)
Index = Obj.Add(40)
Index = Obj.Add(20)
'Gets the number of elements actually contained in the ArrayList object.
Cnt = Obj.Count()  
'Output: 3