OBJECT:  WshCollection

The WshCollection object is a read-only collection object that contains the list of active network drives and printer connections as returned by the WshNetwork.EnumNetworkDrives and WshNetwork.EnumPrinterConnections methods. This object cannot be instantiated directly. It can only be accessed through the aforementioned WshNetwork object methods.

As with all collection objects, the WshCollection collection can be iterated using the VBScript "For Each .. In" statement, but cannot be iterated using the JScript "for .. in" syntax.

PROPERTIES

length Property
The length property is read only and returns a Long value which is the number of items in the collection.

Syntax: object.length


 
METHODS

Count Method
The Count method returns a Long value which is the number of items in the collection.

Syntax: object.Count()

Item Method
The Item method is the default method of the WshCollection object. It takes a single argument which, although of type Variant, only returns useful results when it is a Long. When passed an argument of type Long, this method returns the element in the collection at the specified position. Indexing starts at zero. If there is no element at the requested index, a "Subscript out of range" error is generated.

Syntax: object[.Item](varIndex)

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information