<-- Previous || Up || Next -->

Max 2 Function
Comparisons Class

Public Function Max2( _
      ByVal vOne As Variant _
    , ByVal vTwo As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

"Maximum of Two Values"
Return the maximum of two arguments.
Returns the argument on the left (vOne) if arguments are equal.

    Max2(23, 45) = 45
    Max2("ST", "SC") = "ST"
    Max2("ST", "sc") = "sc"
    Max2("ST", "sc", vbTextCompare) = "ST"
    IsNull(Max2(12, Null)) = True
    IsNull(Max2(Null, "SF")) = True
See also:
    Max2Real Function
    Max2Variant Function
    Min2 Function
    StrComp Function (Visual Basic)
Summary: Function returns Null if either argument is Null. Function uses string comparisons if either argument is a string. Function uses numeric comparisons if both arguments are numeric.

vOne: First of two values, the maximum of which will be returned. Function returns Null if vOne is Null.
vTwo: Second of two values, the maximum of which will be returned. Function returns Null if vTwo is Null.
vCompare: Specifies the type of comparisons used to determine if strings match when comparing string arguments. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.
Note: This function DOES support three-valued logic because if either argument (vOne or vTwo) is Null this function will return Null. This function does NOT support arguments whose types are other than Empty, Null, String, or numeric. For example, passing an Object pointer to this function will cause it to generate a runtime error.
Note: If a string is compared to a number, and the number (when represented in string form) is "more" than the string, the number will be returned in string form.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.