JavaScript Editor js editor     Web development 

Main Page

Use to remove a member object from a collection.

The member object can have any valid type that can be assigned to a memory variable. This includes simple data types, such as strings, numbers, dates, logical, or more complex ones such as Visual FoxPro and Component Object Model (COM) objects.

Collection.Remove( eIndex )



Specifies an expression that represents a position of an item in the collection. This expression can be one of two types:
  • Numeric. The eIndex expression must have a value from 1 to the value of the Count property for the collection. If you pass a value of -1, Visual FoxPro removes all items in the collection.

  • String. The eIndex expression must correspond to the cKey that was specified for the item when it was added to the collection.

If eIndex does not match an existing member of the collection, an error occurs.


  • If an incorrect type is passed for a specific parameter, an error occurs.

  • Include the NODEFAULT command in the Remove method for collection objects to prevent removing a particular item from the collection.


The following example illustrates these tasks at run time:

  • Creates forms and a collection.

  • Adds forms to the collection.

  • Displays the number of forms in the collection.

  • Removes the first form from the collection.

  • Displays the current number of forms in the collection.

В Copy Code
loForm1 = CREATEOBJECT("myForm1")
loForm2 = CREATEOBJECT("myForm2")
loCol = CREATEOBJECT("myCollection")
? loCol.Count
? loCol.Count

See Also

JavaScript Editor js editor     Web development