VBScript » Dictionary » Items

Version: 2.0

Syntax:
[arrayname = ] object. Items

The Items method is used to retreive all of the items in a particular Dictionary object and store them in an array.

We can then iterate through the items using a For....Next loop.

Examples

Code:
<%
dim guitars, arrayItems, i
set guitars=CreateObject("Scripting.Dictionary")
guitars.Add "e", "Epiphone"
guitars.Add "f", "Fender"
guitars.Add "g", "Gibson"
guitars.Add "h", "Harmony"
arrayItems = guitars.Items
for i = 0 to guitars.Count -1
Response.Write "<br>" arrayItems(i)
next
%>
Output:
"Epiphone"
"Fender"
"Gibson"
"Harmony"
Explanation:

This code demonstrates using the Dictionary object's Count property to determine the amount of key/item pairs.