Exists Method

 

Description

 

Returns VARIANT_TRUE (-1) if a specified key exists in the Dictionary object, VARIANT_FALSE (0) if it does not.

 

PowerBASIC Syntax

 

METHOD Exists ( _

BYREF vKey AS VARIANT _

) AS LONG

 

Arguments

 

vKey

Key value being searched for the Dictionary object.

 

Return Value

 

Boolean. VARIANT_TRUE or VARIANT_FALSE.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM pDic AS IDictionary

DIM vKey AS VARIANT

DIM vItem AS VARIANT

DIM bExists 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

' Check if the key "c" already exists

vKey = "c"

bExists = pDic.Exists(vKey)

 

Valid XHTML 1.0 Transitional