从 ArrayList 对象中删除首次出现的特定元素。
语法
Object.Remove(Element)
参数:
Object:必需。始终为 ArrayList 对象的名称。
Element:必需。要从 ArrayList 对象中删除的元素。
注释
以下示例说明了 Remove 方法的用法。
示例 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)
'Output: Obj contains 10, 40, 20, 30
'Remove Element from the ArrayList Object
Obj.Remove(20)
'Output: Obj contains 10, 40, 30