Método RemoveAt

Remove o elemento no índice especificado do objeto ArrayList.

Sintaxe

Object.RemoveAt(Index)

Argumentos:

  • Object: Obrigatório. Sempre o nome do objeto ArrayList.

  • Index: Obrigatório. O índice baseado em zero do elemento a ser removido.

Comentários

O exemplo a seguir ilustra o uso do método RemoveAt.

Exemplo 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