Removes a member from a Collection object.
Public Overloads Sub Remove(ByVal { Key As String | Index As Integer })
| Exception type | Error number | Condition |
|---|---|---|
| 5 | Key is invalid or not specified. | |
| 9 | Index does not match an existing member of the collection. |
If Index doesn't match an existing member of the collection, an error occurs.
This example illustrates the use of the Remove method to remove objects from a Collection object, birthdays.
Dim birthdays As New Collection() birthdays.Add(New DateTime(2001, 1, 12), "Bill") birthdays.Add(New DateTime(2001, 1, 13), "Joe") birthdays.Remove(1)birthdays.Remove("Joe")
Namespace: Microsoft.VisualBasic
Module: Collection
Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)
Add Method |