Property:  Dictionary.CompareMode

object.CompareMode[ = comparison_mode]

The CompareMode property is used to set and return the key's string comparison mode which determines how keys are matched while looking up or searching. Keys can be treated as case-sensitive or case-insensitive.

The CompareMode property must be set on a Dictionary object before adding any data or an error will occur.

The available comparison modes are:
vbBinaryCompare = 0 (default)
vbTextCompare = 1

In the following example the Add method fails on the last line because the key "b" already exists. If CompareMode were set to vbBinaryCompare a new key "B" (upper case) with a value of "Bentley" will be added to the dictionary.

Code:
<%
Dim d
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = vbTextCompare    

d.Add "a", "Alvis"
d.Add "b", "Buick"
d.Add "c", "Cadillac"
d.Add "B", "Bentley"   'fails here.
%>

Output:
"Alvis"
"Buick"
"Cadillac"

Copyright 1999 by Infinite Software Solutions, Inc.
Trademark Information