Removeメソッド

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