Item Property |
Description
Sets or returns an item for a specified key in a Dictionary object. For collections, returns an item based on the specified key. Read/write.
PowerBASIC Syntax
Arguments
Remarks
If key is not found when changing an item, a new key is created with the specified vNewItem. If key is not found when attempting to return an existing item, a new key is created and its corresponding item is left empty.
Example [PowerBASIC]
#INCLUDE "windows.inc" #INCLUDE "scrrun.inc"
DIM pDic AS IDictionary DIM vKey AS VARIANT DIM vItem AS VARIANT DIM newKey AS VARIANT DIM newItem AS VARIANT
' Create an instance of the Dictionaty object pDic = NEWCOM "Scripting.Dictionary" vKey = "a" : vItem = "Athens" ' Add some key/item pairs to the dictionary pDic.Add vKey, vItem vKey = "b" : vItem = "Belgrade" pDic.Add vKey, vItem vKey = "c" : vItem = "Cairo" pDic.Add vKey, vItem ' Change key "b" to "m" and "Belgrade" to "México" vKey = "b" : vNewKey = "m" pDic.Key(vKey) = vNewKey vItem = "m" : vNewItem = "México" pDic.Item(vItem) = vNewItem ' Get the item for key "m" and display it vItem = EMPTY : vKey = "m" vItem = pDic.Item(vKey)
|