VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />
FormatNumber<br />
Description Returns an expression <strong>for</strong>matted as a number.<br />
Usage realVal = FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit<br />
[,UseParensForNegativeNumbers [,GroupDigits]]]])<br />
Arguments Expression<br />
Required. Expression to be <strong>for</strong>matted.<br />
NumDigitsAfterDecimal<br />
Optional. Numeric value indicating how many places to the right of the decimal are displayed.<br />
Default value is -1, which indicates that the computer's regional settings are used.<br />
IncludeLeadingDigit<br />
Optional. Tristate constant that indicates whether or not a leading zero is displayed <strong>for</strong><br />
fractional values. See Settings section <strong>for</strong> values.<br />
UseParensForNegativeNumbers<br />
Optional. Tristate constant that indicates whether or not to place negative values within<br />
parentheses. See Settings section <strong>for</strong> values.<br />
GroupDigits<br />
Optional. Tristate constant that indicates whether or not numbers are grouped using the<br />
group delimiter specified in the control panel. See Settings section <strong>for</strong> values.<br />
Settings The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the<br />
following settings:<br />
Constant Value Description<br />
TristateTrue -1 True<br />
TristateFalse 0 False<br />
TristateUseDefault -2 Use the setting from the computer's regional settings.<br />
Return A real number either Single or Double subVariant type<br />
Remarks When one or more of the optional arguments are omitted, the values <strong>for</strong> omitted arguments are<br />
provided by the computer's regional settings. All settings in<strong>for</strong>mation comes from the Regional<br />
Settings Number tab (locale setting).<br />
See Also FormatCurrency, FormatDateTime, FormatPercent<br />
Example Function FormatNumberDemo<br />
Dim MyAngle, MySecant, MyNumber<br />
MyAngle = 1.3 ' Define angle in radians.<br />
MySecant = 1 / Cos(MyAngle) ' Calculate secant.<br />
FormatNumberDemo = FormatNumber(MySecant,4) ' Format MySecant to four decimal<br />
places.<br />
End Function<br />
134 <strong>InduSoft</strong>, Ltd.