DataFunctions.ValidateFloat

Ee798801.c++_on(en-US,CS.10).gifEe798801.vb_off(en-US,CS.10).gif

Use this method to check whether a string contains a valid floating-point number, and to optionally check the value of the number against a specified range.

Definition

Function ValidateFloat(vtNumber As Variant,vtMin As Variant,vtMax As Variant) As Variant

Parameters

vtNumber

A Variant that contains the floating-point number to validate.

vtMin

A Variant that contains a value specifying the low end of the range. The default value for this parameter is NULL, which means that the vtMin parameter is ignored in the range validation.

vtMax

A Variant that contains a value specifying the high end of the range. The default value for this parameter is NULL, which means that the vtMax parameter is ignored in the range validation.

Return Values

If this method completes successfully, it returns a Boolean Variant that indicates whether the vtNumber parameter is valid. A value of True indicates the vtNumber parameter is a valid floating-point number, and that it is within the given range, if any.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

<HTML>
<HEAD>
</HEAD>
<BODY>
<%
Dim Result
Dim Amount
Set MSCSDataFunctions = Server.CreateObject("Commerce.DataFunctions")
' Set Locale to USA
myFloat = 12.33
MSCSDataFunctions.Locale = myLocale
Result = MSCSDataFunctions.ValidateFloat(myFloat, 1, 10)
Response.Write myFloat & " Is this float between 1 & 10?: " & " " _
    & Result & "<P>"
myFloat = 2.33
Result = MSCSDataFunctions.ValidateFloat(myFloat, 1, 10)
Response.Write myFloat & " Is this float between 1 & 10?: " & " " _
    & Result & "<P>"
%>
</BODY>
</HTML>

See Also

DataFunctions Object

DataFunctions.Float

DataFunctions.ConvertFloatString


All rights reserved.