a. Add: Adds a new key/item pair to a Dictionary object
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"
b. Exists : It checks whether our specified key is exist or not in dictionary(it returns Boolean value either true or false). E.g. a=d.Exists("c")
c. Items: Returns (an array of) all the items in a Dictionary object
Dim a, d, i, s ' Create some variables.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" ' Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
a = d
.Items
' Get the items.For i = 0 To d.Count -1 ' Iterate the array.
Msgbox a(i) ' Create return string.
Next
d. Keys: Returns (an array of) all the keys in a Dictionary object
Dim a, d, i, s ' Create some variables.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" ' Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
a = d
.keys
' Get the items.For i = 0 To d.Count -1 ' Iterate the array.
Msgbox a(i) ' Create return string.
Next
e. Count: Returns the number of key/item pairs in a Dictionary object
Dim a, d, i, s ' Create some variables.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" ' Add some keys and items.
d.Add "b", "Belgrade"
a=
d.Count
f. Item :Sets or returns the value of an item in a Dictionary object
ItemDemo =
d.Item(
"c")
' Get the item.g. Key : It changes the existing key name.
d.Key(
"c")
= "d" ' Set key for "c" to "d"
No comments:
Post a Comment