item Method (Visual Studio - JScript)
Returns the current item in the collection.
function item() : Number
Remarks
The item method returns the current item in an Enumerator object. If the collection is empty or the current item is undefined, it returns undefined.
Example
In following code, the item method is used to return a member of the Drives collection.
function ShowDrives()
{
var s = "";
var fso = new ActiveXObject("Scripting.FileSystemObject");
var e = new Enumerator(fso.Drives);
e.moveFirst();
while (e.atEnd() == false)
{
var x = e.item();
s += x.DriveLetter;
s += " - ";
if (x.DriveType == 3)
s += x.ShareName;
else if (x.IsReady)
s += x.VolumeName;
else
s += "[Drive not ready]";
s += "\n";
e.moveNext();
}
return(s);
}
Requirements
Applies To:
See Also
Reference
Change History
Date |
History |
Reason |
---|---|---|
July 2009 |
Modified example. |
Information enhancement. |