PowerBasic Museum 2020-A

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Windows Script Runtime => Source Code => Scripting => Dictionary Object => Topic started by: José Roca on July 13, 2008, 10:32:54 PM

Title: IDictionary.Count Property
Post by: José Roca on July 13, 2008, 10:32:54 PM


The following example illustrates the use of the Count property.


#INCLUDE "windows.inc"
#INCLUDE "scrrun.inc"

DIM pDic AS IDictionary
DIM vKey AS VARIANT
DIM vItem AS VARIANT
DIM nCount AS LONG

' Create an instance of the Dictionaty object
pDic = NEWCOM "Scripting.Dictionary"
' Add some key/item pairs to the dictionary
vKey = "a" : vItem = "Athens"
pDic.Add vKey, vItem
vKey = "b" : vItem = "Belgrade"
pDic.Add vKey, vItem
vKey = "c" : vItem = "Cairo"
pDic.Add vKey, vItem
' Retrieve the number of items in the collection
nCount = pDic.Count