Microsoft® JScript™ moveFirst Method | Language Reference Version 3

See Also Applies To

##### Description

> Resets the current item in the collection to the first item.

##### Syntax

> myEnum.moveFirst( )

> The myEnum argument is any Enumerator object.

##### Remarks

> If there are no items in the collection, the current item is set to undefined.

> In following example, the moveFirst method is used to begin evaluating members of the Drives collection from the beginning of the list:

> >     function ShowFirstAvailableDrive()
> >     {
> >       var fso, s, e, x;
> >       fso = new ActiveXObject("Scripting.FileSystemObject");
> >       e = new Enumerator(fso.Drives);
> >       e.moveFirst();
> >       s = "";
> >       do
> >       {
> >          x = e.item();
> >          if (x.IsReady)
> >          {
> >            s = x.DriveLetter + ":";
> >            break;
> >          }
> >          else
> >            if (e.atEnd())
> >            {
> >              s = "No drives are available";
> >              break;
> >            }
> >          e.moveNext();
> >       }
> >       while (!e.atEnd());
> >       return(s);
> >     }

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.