Item Method

 

Description

 

Exposes a specified item from a collection.

 

PowerBASIC Syntax

 

METHOD Item ( _

BYVAL vIndex AS VARIANT _

) AS VARIANT

 

Arguments

 

vIndex

VARIANT. Item to retrieve.

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

DIM pWsh AS IWshShell

DIM pSpecialFolders AS IWshCollection

DIM nCount AS LONG

DIM i AS LONG

DIM vItem AS VARIANT

DIM vValue AS VARIANT

 

pWsh = NEWCOM "WScript.Shell"

' Get a reference to the special folders collection

pSpecialFolders = pWsh.SpecialFolders

 

' Get the number of objects in the collection

nCount = pSpecialFolders.Count

 

' Enumerates the collection

FOR i = 0 TO nCount - 1

   vItem = i AS LONG

   vValue = pSpecialFolders.Item(vItem)

   IF OBJRESULT THEN EXIT FOR

   STDOUT VARIANT$(vValue)

NEXT

 

Valid XHTML 1.0 Transitional