May 1995
Beginner
508 pages
16h 14m
English
Dictionary.Items Method
dictionaryobject.Itemsdictionaryobject
Use: Required
Data Subtype: Dictionary object
A reference to a Dictionary object.
A Variant array.
Returns an array containing all the items in the specified Dictionary object.
The returned array is always a zero-based variant array whose data subtype matches that of the items in the Dictionary object.
The following ASP example uses Global.asa to
generate a session-level Dictionary object containing the names of
some Shakespearean plays, then uses the Items property to display
them to a web page. The contents of Global.asa
are:
<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Sub Session_OnStart
Dim oDict
Set oDict = Server.CreateObject("Scripting.Dictionary")
oDict.Add "MER", "The Merchant of Venice"
oDict.Add "HAM", "Hamlet"
oDict.Add "TEM", "The Tempest"
oDict.Add "MAC", "MacBeth"
oDict.Add "OTH", "Othello"
oDict.Add "ADO", "Much Ado about Nothing"
oDict.Add "LEA", "King Lear"
Set Session.Contents.Item("PLAYS") = oDict
End Sub
</SCRIPT>The web page that actually retrieves the array returned by the Items property is:
<HTML> <HEAD> <TITLE>Shakespeare's Plays</TITLE> </HEAD> <BODY> <CENTER><H2>Selected Shakespeare Plays</H2></CENTER> <P> Click on the play about which you'd like more information:<P> <% Dim sPlay, sPlays sPlays = Session.Contents("PLAYS").Items For Each sPlay in sPlays Response.Write "<A HREF=" & chr(34) & sPlay & ".htm" & _ chr(34) & ">" & sPlay & "</A><P>" ...Read now
Unlock full access