RemoveAt 메소드

ArrayList 객체의 지정된 인덱스에 있는 요소를 제거합니다.

구문

Object.RemoveAt(Index)

인수:

  • Object: 필수. 항상 ArrayList 객체의 이름입니다.

  • Index: 필수. 제거할 요소의 0부터 시작하는 인덱스입니다.

주석

다음 예에서는 RemoveAt 메소드의 사용을 보여 줍니다.

예 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