Bug? Move text number to double

atiaust

Active Member
Licensed User
Longtime User
Hi All,

Not sure if this a bug or I am missing something.

I have a textfield on a form, textField1.
If I enter '-1.0' into the textfield and use the following code:

dim newNum as double = textField1.text

This causes: java.lang.NumberFormatException: For input string: "-"

I assumed a 'double' could have a negative number?

Thanks

On further investigation the error occurs in the code below:
B4X:
private Sub txtPayAmnt_TextChanged (Old As String, New As String)
    Dim newPay As Double = New
    If newPay <= 0 Then
        Main.dlg.ToastMessage("Can't input negative numbers",3000)
    End If
End Sub
 
Last edited:
Top