Object that stores data key, item pairs.
A Dictionary object is the equivalent of a PERL associative array. Items
can be any form of data, and are stored in the array. Each item is associated
with a unique key. The key is used to retrieve an individual item and is usually
a integer or a string, but can be anything except an array.
Methods
Add Method (Dictionary) | Exists Method | Items
Method | Keys Method | Remove Method | RemoveAll Method
Properties
Count Property | Item Property | Key
Property
Dim d ' Create a variable.
Set d = CreateObject("Scripting.Dictionary")
d.Add
"a", "Athens" ' Add some keys and items.
d.Add
"b", "Belgrade"
d.Add
"c", "Cairo"
Add
"a", "Athens" ' Add some keys and items.
d.Add
"b", "Belgrade"
d.Add
"c", "Cairo"Functions can return a dictionary object and it can indeed use to return multiple values from a Functions. Alternately Function can return multiple value using Array as well
Dim dicObj
Set dicObj = CreateObject("Scripting.Dictionary")
Set obj=getname
MsgBox(obj.item("name"))
Public Function getname()
dicObj.add "name","Uday Kumar"
Set getname=dicObj
End function
No comments:
Post a Comment