FormatTextToStoredNumber

Converts a number passed as a String to a Double. Use this method to convert numbers returned by Financial Management methods such as GetTextCell and GetTextCells.

Syntax

<HsvData>.FormatTextToStoredNumber bstrText, sDecimalChar, sThousandsChar, pbIsValidNumber, pbIsNumberNoData, pdNumber

Argument

Description

bstrText

String (ByVal). The String to be converted.

sDecimalChar

Integer (ByVal). The double-byte Integer that identifies the decimal character used in the bstrText argument. Use AscW to get the delimiter’s Integer equivalent.

sThousandsChar

Integer (ByVal). The double-byte Integer that identifies the thousands separator character used in the bstrText argument. Use AscW to get the delimiter’s Integer equivalent.

pbIsValidNumber

Boolean. Returns TRUE if the bstrText argument contains a number that can be converted to a Double, otherwise FALSE.

pbIsNumberNoData

Boolean. Returns TRUE if the bstrText argument is 0, otherwise FALSE.

pdNumber

Double. Returns the formatted Double equivalent of the String passed to the bstrText argument.

Example

The following example converts the String passed to FormatTextToStoredNumber. Note how the decimal and thousands delimiters are specified. To illustrate the example, if 22,445,987.23 is passed, 22445987.23 is assigned to the dRet variable.

Dim cData As HsvData, iDec As Integer, iThous As Integer
Dim bIsValid As Boolean, bNoData As Boolean, dRet As Double
Set cData = m_cSession.Data
iDec = AscW(".")
iThous = AscW(",")
cData.FormatTextToStoredNumber m_sCellData, iDec, iThous, _ 
bIsValid, bNoData, dRet