RemoveAt Method
Removes the element at the specified index of the ArrayList
object.
Syntax
Object.RemoveAt(Index)
Arguments:
-
Object: Required. Always the name of
ArrayList
object. -
Index: Required. The zero-based index of the element to remove.
Remarks
The following example illustrates the use of the RemoveAt
method.
Example 1:
'Create ArrayList Object
Dim Obj
Set Obj = CreateObject("System.Collections.ArrayList")
'Add Elements to the end of ArrayList Object
Dim Index
Index = Obj.Add(10)
Index = Obj.Add(40)
Index = Obj.Add(20)
Index = Obj.Add(30)
'Remove Element from the ArrayList Object
Index = 3
If index < Obj.Count() Then
Obj.RemoveAt(Index)
End If
'Display ArrayList Elements after Remove
For Each Element In Obj
'Operation based on requirement with the Element
Next
'Output: Obj contains 10, 40, 20