Click to See Complete Forum and Search --> : When adding to a Dictionary (object), how do you check for duplicate keys?


John Reynolds
June 26th, 2001, 05:51 PM
Thanks for any help . . .

CodeBlue
June 26th, 2001, 09:57 PM
There is an Exists method for the Dictionary object that is used to see if a specified key exists. If you try adding a key that already exists, you'll get an error.


Dim d
set d = new Dictionary
if d.Exists("a") then
msgbox "already exists!"
else
d.Add "a", "Athens"
endif