Started with web version…got a little math problem
I have a cash textfield and a Loan textfield.
The cash field starts with 4000000 and I want the cash field automatically update as I input the Loan amount in the Loan textfield.
When I input 2000000 in Loan field, I got an updat of “2.000000e+6” instead of “2000000”.
Is this a formatting problem?
depends… did you format it? in what manner did you tell you app to display the value?
default formatting of double values, will go to SciNot format when certain circumstances occur…
so , no, it probably is not a “problem”… it is most likely the app doing exactly what would be considered normal behaviour.
So how should I format those 2 fields so that I can get a Cash= 4000000 - Loan=2000000, and having Cash update and show 2000000?
The following give me the Sci-representation
Cash.text = str(val(Cash.text) - val(Loan.text))
It may be overkill, but after I was bitten by this STR() issue I now use this method to return an Integer as a String.
[code]Protected Function getLargeIntegerWAD(largeNumber As Double, decimalPoints As Integer = 0, formatString As String = “-####################0”) as String
Dim returnResult As String
if decimalPoints > 0 and instr(formatString, “.”) = 0 then 'don’t add two periods!
formatString = formatString + “.”
for tempInt As Integer = 0 to decimalPoints
formatString = formatString + “0”
returnResult = Format(largeNumber, formatString)
if instr(formatString, “.”) > 0 then 'don’t remove the final zero if it’s not a decimal!
while right(returnResult, 1) = “0” and NthField(returnResult, “.”, 2).len > decimalPoints
returnResult = left(returnResult, len(returnResult) - 1) 'remove trailing zeros
if right(returnResult, 1) = “.” then returnResult = left(returnResult, len(returnResult) - 1) 'remove trailing period