ArrayListオブジェクトの末尾に要素を追加します。
構文
Object.Add (Element)
引数:
Object: 必須。常にArrayListオブジェクトの名前。
Element: 必須。ArrayListの最後に追加する要素
戻り値
要素が追加されたArrayList索引
備考
次の例では、Addメソッドの使用方法を示します。
例1:
'Create ArrayList Object
Dim Obj
Set Obj = CreateObject("System.Collections.ArrayList")
'Add Elements to the ArrayList Object
Dim Index
Index = Obj.Add(10)
'Output: 0
Index = Obj.Add(40)
'Output: 1
Index = Obj.Add(20)
'Output: 2
'Output: Obj contains 10, 40, 20
例2:
'Create ArrayList Object
Dim Obj
Set Obj = CreateObject("System.Collections.ArrayList")
'Add Elements to the end of the ArrayList Object
Dim Index
Index = Obj.Add("Banana")
'Output: 0
Index = Obj.Add("Apple")
'Output: 1
Index = Obj.Add("Grapes")
'Output: 2
'Output: Obj contains "Banana", "Apple", "Grapes"