Private Sub BMCAmountFormatter_FormatDoubleField(ByVal FieldText As String, FormattedText As String, ErrDescription As String, ValidFormat As Boolean, ByRef DoubleVal As Double, ByRef DoubleFormatted As Boolean)
Dim pTmpField As New CscXDocField
pTmpField.Text = FieldText
' use the standard amount formatter first
ValidFormat = DefaultAmountFormatter.FormatField(pTmpField)
DoubleVal = pTmpField.DoubleValue
DoubleFormatted = pTmpField.DoubleFormatted
FormattedText = pTmpField.Text
If ValidFormat = False Then
ErrDescription = pTmpField.ErrorDescription
End If
' check for minus sign inside original text
' you could also be more strict and allow only the first or the last character to be a
' minus sign, but this might cause problems if the currency symbol is also there
If InStr(FieldText, "-") > 0 Then
' make it negative
FormattedText = "-" +FormattedText
DoubleVal = - DoubleVal
End If
End Sub
