Collection.Remove Method


Collection.Remove Method

Class

Microsoft.VisualBasic.Collection

Syntax

     objectVariable.Remove(index) 


objectvariable (required; Collection)

The instance of a Collection from which an item is to be removed


index (required; Integer or String)

Either the 1-based ordinal position (Integer) or the unique key (String) of an item in the collection

Description

The Remove method removes an item from a collection based on its position or its unique key.

Usage at a Glance

  • Members of the collection that follow the removed member are automatically moved by one ordinal position; no gaps are left in the collection. This also means that the ordinal positions of many members may change during a deletion.

  • If you are deleting multiple members of a collection by numeric index value, you should delete them backwardsfrom highest index value to lowestsince the collection is reindexed after each deletion.

  • The Clear method of the Collection class removes all items immediately.

Version Differences

Visual Basic 2005 adds support for generics to several collection-style classes. Generics are discussed in Chapter 10.

See Also

Collection Class, Collection.Add Method, Collection.Count Property, Collection.Item Property




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net