從 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