VBS TUTORIAL: function-formatcurrency function _vbs

Source: Internet
Author: User
Tags locale locale setting numeric value

FormatCurrency function

Returns an expression that has been formatted as a currency value (using the currency symbol defined in the System Control Panel).

FormatCurrency(
  expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]
)

Parameters

Expression

Required option. The expression to be formatted.

Numdigitsafterdecimal

Options available. A numeric value indicating the number of digits displayed to the right of the decimal point. The default value is-1, which indicates that the computer's locale is being used.

IncludeLeadingDigit

Options available. A three-state constant that indicates whether to display a decimal value of 0 in the front. For numeric values, see the "Settings" section.

UseParensForNegativeNumbers

Options available. A three-state constant that indicates whether negative values are placed in parentheses. For numeric values, see the "Settings" section.

GroupDigits

Options available. A three-state constant that indicates whether numbers are grouped by using the numeric grouping symbols specified in the computer locale. For numeric values, see the "Settings" section.

Set up

The IncludeLeadingDigit, useparensfornegativenumbers, and GroupDigits parameters can have the following values:

Constants value Description
TristateTrue -1 True
Tristatefalse 0 False
Tristateusedefault -2 Use the settings in your computer's regional settings.

Description

When one or more optional arguments are omitted, the computer locale provides the value of the omitted parameter. The position of the currency symbol associated with the currency value is determined by the locale setting of the system.

Note All other settings information is taken from the Currency tab of the locale, except for the "show starting 0" setting from the "Number" tab from the locale.

The following example uses the formatcurrency function to format expression as currency and assign to Mycurrency:

  Dim mycurrencymycurrency =   FormatCurrency ( 1000 )  " Mycurrency    contains  $1000.00 . 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.