Name

Dictionary.Keys Method

Syntax

                  dictionaryobject.Keys
dictionaryobject

Use: Required

Data Type: Dictionary object

A reference to a Dictionary object.

Return Value

An array of strings.

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 type is String.

Programming Tips and 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, 2nd Edition 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.