18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

Scripting Dictionary Object<br />

A dictionary object is part of the Scripting type library. The dictionary object is a special type of an array<br />

which stores a data item that is associated with a unique key. The key, which is usually a number or a<br />

string, is used to retrieve an individual item. You can use a Dictionary when you need to access random<br />

elements frequently or need to access in<strong>for</strong>mation contained in the array based on its value, not<br />

position.<br />

The Dictionary object has both Methods and Properties that can be used to manipulate the Dictionary.<br />

Dictionary Methods<br />

Method Description<br />

Add Adds a key and item pair<br />

Exists Indicates if a specific key exists<br />

Items Returns an array containing all items in a Dictionary object<br />

Keys Returns an array containing all keys in a Dictionary object<br />

Remove Removes a key, item pair<br />

RemoveAll Removes all key, item pairs<br />

Dictionary Properties<br />

Method Description<br />

CompareMode The comparison mode <strong>for</strong> string keys<br />

Count The number of items in a Dictionary object<br />

Item An item <strong>for</strong> a key<br />

Key A key<br />

The following code creates a Dictionary object and adds items and keys:<br />

Dim d 'Create a variable<br />

Set d = CreateObject("Scripting.Dictionary")<br />

d.Add "a", "Athens" 'Add some keys and items<br />

d.Add "b", "Belgrade"<br />

d.Add "c", "Cairo"<br />

30 <strong>InduSoft</strong>, Ltd.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!