warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\inetpub\Websites\DevGuru\www\includes\common.inc(1762) : eval()'d code on line 1.

VBScript » Objects » Dictionary

Version: 2.0

The Dictionary object stores name/value pairs (referred to as the key and item respectively) in an array. The key is a unique identifier for the corresponding item and cannot be used for any other item in the same Dictionary object.


Dim cars
Set cars = CreateObject("Scripting.Dictionary")
cars.Add "a", "Alvis"
cars.Add "b", "Buick"
cars.Add "c", "Cadillac"
Response.Write "The value corresponding to the key 'b' is "
"The value corresponding to the key 'b' is Buick"

This code creates a Dictionary object called "cars", adds some key/item pairs, retrieves the item value for the key 'b' using the Item property and then outputs the resulting string to the browser.



Syntax: object.CompareMode[ = comparison_mode]

The CompareMode property is used to set and return the key's string comparison mode which determines how keys are matched while looking up or searching. Syntax: object. Count Property Syntax: object.


Syntax: object.Count

The Count property is used to determine the number of key/item pairs in the Dictionary object.


Syntax: object.(key) [ = itemvalue]

The Item property allows us to retreive the value of an item in the collection designated by the specified key argument and also to set that value by using itemvalue.


Syntax: object.Key(keyvalue) = newkeyvalue

The Key property lets us change the key value of an existing key/item pair.



Syntax: object.Add keyvalue, itemvalue

The Add method is used to add a new key/item pair to a Dictionary object.


Syntax: object.Exists (keyvalue)

The Exists method is used to determine whether a key already exists in the specified Dictionary. Returns True if it does and False otherwise.


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.


Syntax: object.Keys

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


Syntax: object.Remove(keyvalue)

The Remove method is used to remove a single key/item pair from the specified Dictionary object.


Syntax: object.RemoveAll

The RemoveAll method is used to remove all the key/item pairs from the specified Dictionary object.



See Also: