O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Dictionary.Items Method

Syntax

                  dictionaryobject.Items
dictionaryobject

Use: Required

Data Type: Dictionary object

A reference to a Dictionary object.

Return Value

A Variant array.

Description

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

Rules at a Glance

The returned array is always a zero-based variant array whose data type matches that of the items in the Dictionary object.

Programming Tips and Gotchas

  • The only way to directly access members of the Dictionary is via their key values. However, using the Items method, you can “dump” the data from the Dictionary into a zero-based variant array. The data items can then be accessed like an array in the normal way, as the following code shows:

    Dim vArray
    vArray = DictObj.Items
    For i = 0 to DictObj.Count -1
        Response.Write vArray(i) & "<P>"
    Next I
  • The Items method retrieves only the items stored in a Dictionary object; you can retrieve all the Dictionary object’s keys by calling its Keys method.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required