AppFrameWork.RequestMoneyAsNumber

Ee824900.c++_on(en-US,CS.10).gifEe824900.vb_off(en-US,CS.10).gif

Use this method to retrieve a value from a URL query string or form post variable and convert it as money, based on the specified locale.

Definition

Function RequestMoneyAsNumber(bstrName As String,Optional vtDefault As Variant,Optional vtMin As Variant,Optional vtMax As Variant,Optional vtLocale As Variant) As Variant

Parameters

bstrName

A String that contains the name of the URL query string or form post variable to retrieve.

vtDefault

A Variant that contains the value to return if the requested URL query string or form post variable is not present or contains no value. If this parameter is also not supplied, the method returns NULL. If the default value is a string value, it will be converted into the base monetary value; otherwise, it is assumed that the value is in base monetary units. This parameter is optional.

vtMin

A Variant that contains the monetary value that specifies the low end of the range against which to validate the converted value. A value in base monetary units is expected for the vtMin parameter. If the converted value is less than vtMin, then NULL is returned. This parameter is optional.

vtMax

A Variant that specifies the high end of the range against which to validate the converted value. A value in base monetary units is expected for the vtMax parameter. If the converted value is greater than vtMax, then NULL is returned. This parameter is optional.

vtLocale

A Variant that contains the number that specifies the locale to use to convert the bstrName parameter. If this parameter is not used, the RequestMoneyAsNumber method uses the value of the Locale property of the DataFunctions object. This parameter is optional.

Return Values

If this method completes successfully, it returns a Variant that contains a number in the base monetary units of the specified or default locale. If any validation fails, the return value will be NULL.

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

If this method completes successfully it returns a number that represents the value of the specified string in the base monetary unit of the specified local. Thus, given a value in US dollars, it returns the number of cents in that value.

This method converts the specified String based on the locale specified in the vtLocale parameter if the vtLocale parameter is specified; otherwise it uses the default locale found in the DataFunctions object. It validates the result of the conversion against the vtMin and vtMax parameters, if they are specified. If the validation fails this method returns NULL.

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

Example

' oAppFrameWork is a Commerce.AppFrameWork object.
' In the following example, the value of a field on the purchase
' form (filled out by the customer) is read into the 
' variable list_price.
 
<FORM METHOD ="POST" ACTION="PROCESS.ASP">
<INPUT TYPE="Text" NAME="list_price"> 
<INPUT TYPE="SUBMIT" NAME="ACTION" VALUE="Send Info">
</FORM>
' The vtMax argument is the upper limit 
' of a Variant variable. Using this value as the upper limit and
' zero (0) as the lower limit of the range check ensures that 
' the value is not negative:
list_price = oAppFrameWork .RequestMoneyAsNumber("list_price", 0, 0, _
    2147483647)

See Also

AppFrameWork Object

DataFunctions.Locale

DataFunctions.ConvertMoneyStringToNumber

DataFunctions.Money

AppFrameWork.RequestFloat

AppFrameWork.RequestNumber


All rights reserved.