B4J Question Edittext invalid double


New Member
Licensed User
Longtime User
I have a regular edittext box with numbers only. When I press done with the box being empty I get the number format exception, Invalid double. I need to know how to set it so that if this happens and an empty string is sent that I can either insert an alert or put in a set value and not have the edittext box close. Any help would be greatly appreciated. Thanks.

Sub EditText1_EnterPressed
      If EditText1.Text > 1000 Then EditText1.Text = 1000
      If EditText1.Text < 1 Then EditText1.Text = 0
      Packet = "f" & EditText1.Text
      ToggleButton1.Checked = False


Active Member
Licensed User
Longtime User
Not sure if this helps with an empty string but you may want to try IsNumber.
If IsNumber(EditText1.Text) = True Then
End If
or assign a variable to EditText1
Dim Ans As Double

Ans = EditText1.Text
If IsNumber(Ans) = True Then
End If
Upvote 0