username_987
Member
Hello,
In attached project, it's a simple calculator, I got it to work, however, when pressing any sign (like + or -) for more than once, the app closes
I believe the problem could be in (docalc) sub, the following:
Thank you for helping with it
In attached project, it's a simple calculator, I got it to work, however, when pressing any sign (like + or -) for more than once, the app closes
I believe the problem could be in (docalc) sub, the following:
B4X:
Sub docalc (math As String,newmath As String)
If math = "plus" Then
total = nr1 + nr2
Else If math = "minus" Then
total = nr1 - nr2
Else If math = "mul" Then
total = nr1 * nr2
Else If math = "div" Then
total = nr1 / nr2
Else If math = "percent" Then
total = nr1 / 100
Else
Return
End If
If newmath <> "" Then
mathstr = newmath
nr2 = ""
Else
mathstr = ""
nr2 = ""
End If
nr1 = total
totallb1.Text = NumberFormat(total, 0, 30) & space
End Sub
Thank you for helping with it