Add Method

 

Description

 

Adds a key and item pair to a Dictionary object.

 

PowerBASIC Syntax

 

METHOD Add ( _

BYREF vKey AS VARIANT, _

BYREF vItem AS VARIANT _

)

 

Arguments

 

vKey

The key associated with the item being added.

vItem

The item associated with the key being added.

 

Remarks

 

An error occurs if the key already exists.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM pDic AS IDictionary

DIM vKey AS VARIANT

DIM vItem AS VARIANT

 

' 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

 

Valid XHTML 1.0 Transitional