Dictionary.Exists Method (VB6)

Named Arguments

Yes

Syntax

dictionaryobject.Exists(key)


dictionaryobject

Use: Required

Data Type: Dictionary object

A reference to a Dictionary object.


key

Use: Required

Data Type: String

The key value being sought.

Return Value

Boolean.

Description

Determines if a given key is present in a Dictionary object.

Rules at a Glance

Returns True if the specified key exists in the Dictionary object; False if not.

Programming Tips and Gotchas

If you attempt to return the Item of a nonexistent key, or assign a new key to a nonexistent key, the nonexistent key is added to the dictionary, along with a blank item. To prevent this, you should use the Exists property to ensure that the Key is present in the dictionary before proceeding.

Example

If oDict.Exists(strOldKey) Then
    oDict.Key(strOldKey) = strNewKey
End If   
						

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.13.179