Search DaTutorials:  
HOME
VB Script Tutorials
Introduction
Reference
Tutorials

Exists Method

Returns True if a specified key exists in the Dictionary object, False if it does not.

object.Exists(key)

Arguments

object

Required. Always the name of a Dictionary object.

key

Required. Key value being searched for in the Dictionary object.

Remarks

The following example illustrates use of the Exists method:

Function KeyExistsDemo
   Dim d, msg   ' Create some variables.
   Set d = CreateObject("Scripting.Dictionary")
   d.Add "a", "Athens"   ' Add some   keys and items.
   d.Add "b", "Belgrade"
   d.Add "c", "Cairo"
   If d.Exists("c") Then
      msg = "Specified key exists."
   Else
      msg = "Specified key doesn't exist."
   End If
   KeyExistsDemo = msg
End Function

See Also

Add Method (Dictionary) | Items Method | Keys Method | Remove Method | RemoveAll Method

Applies To: Dictionary Object


     Credit Card Consolidation | Flights to Bangkok | Credit Card Consolidation | Homes for Sale | Ringtones
Home     Link To Us     Ad With Us     Contact Us     Tell A Friend     Affiliates     Blog     MsOfficeHelp