I have 2 labels lblTotal and lblSub.
Currently both labels always have a double value.
When I want to subtract the value of lblTot from lblSub it gives me an "invalid Double" error " I've tried sever ways but always crash the app with that exception
Sub Substract it executes itself by clicking a button
I've tired:
Then I've tried:
Then with Format
I've also tried with round and round2 but always it's the same exception. I don't know what I'm doing wrong.
Currently both labels always have a double value.
When I want to subtract the value of lblTot from lblSub it gives me an "invalid Double" error " I've tried sever ways but always crash the app with that exception
Sub Substract it executes itself by clicking a button
I've tired:
B4X:
Sub Substract
Private SrTot, SrSub As double
Private Result as Double
SrTot = Abs(lblTotal.text) '<crash
SrSub = Abs(lblsub.text)
Result = SrTot - SrSub
Log("Resultado : " &Result)
end Sub
java.lang.NumberFormatException: Invalid double: "2114,19"
Then I've tried:
B4X:
Private SrTot, SrSub As String
Private Result as Double
SrTot = Abs(lblTotal.text) '<< crash
SrSub = Abs(lblsub.text)
Result = SrTot - SrSub
Log("Resultado : " &Result)
end Sub
java.lang.NumberFormatException: Invalid double: "2114,19"
Then with Format
B4X:
Sub Substract
Private SrTot, SrSub As String
Private Result As Double
SrTot = format(lblTotalPagar.text)'<<crash
SrSub = format(lblTotalFactura.text)
Result = SrTot - SrSub
Log("Resultado : " &SrSub)
End Sub
Public Sub format(d As Double) As String
Dim s As String = NumberFormat2(d, 2, 2, 2, False)
Return s.Replace(".", ",")
End Sub
java.lang.NumberFormatException: Invalid double: "2114,19"
I've also tried with round and round2 but always it's the same exception. I don't know what I'm doing wrong.