Property:  Dictionary.CompareMode

Implemented in version 2.0
 
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.

To do the comparison, you use the Comparison Constants. You may use either the CONSTANT (left column) or the VALUE (center column) in your code and get the same results.
 
CONSTANT VALUE DESCRIPTION
VBBinaryCompare 0 binary Comparison
VBTextCompare 1 Text Comparison
VBDataBaseCompare 2 Compare information inside database

 
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-2004 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information