Name

Dictionary.Keys Method

Syntax

                  dictionaryobject.Keys
dictionaryobject

Use: Required

Data Subtype: Dictionary object

A reference to a Dictionary object.

Return Value

A Variant array of subtype String.

Description

Returns an array containing all the Key values in the specified Dictionary object.

Rules at a Glance

The returned array is always a 0-based variant array whose data subtype is String.

Programming Tips & Gotchas

The Keys method retrieves only the keys stored in a Dictionary object. You can retrieve all the Dictionary object’s items by calling its Items method. You can recall an individual data item by using the Dictionary object’s Item property.

Example

Dim vArray
vArray = DictObj.Keys
For i = 0 to DictObj.Count -1
    Response.Write vArray(i) & "<BR>"
Next

Get VBScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.