Items Method

 

Description

 

Returns an array containing all the items in a Dictionary object.

 

PowerBASIC Syntax

 

METHOD Items () AS VARIANT

 

Return Value

 

VARIANT. Array of items.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM pDic AS IDictionary

DIM vKey AS VARIANT

DIM vItem AS VARIANT

DIM vItems AS VARIANT

DIM i AS LONG

 

' Create an instance of the Dictionaty object

pDic = NEWCOM "Scripting.Dictionary"

' Add some key/item pairs to the dictionary

vKey = "a" : vItem = "Athens"

pDic.Add vKey, vItem

vKey = "b" : vItem = "Belgrade"

pDic.Add vKey, vItem

vKey = "c" : vItem = "Cairo"

pDic.Add vKey, vItem

' Get all the items in the collection

vItems = pDic.Items

' Display them

REDIM vArray(0) AS VARIANT

vArray() = vItems

FOR i = LBOUND(vArray) TO UBOUND(vArray)

  PRINT VARIANT$(vArray(i))

NEXT

 

Valid XHTML 1.0 Transitional