Android Question Edittext Box Question

Gavin O'Connor

Member
Licensed User
Hi All,

I am trying to bring up a Message Box and halt the program if no data is entered into an Edittext Box

Currently I am using:

B4X:
Sub Button1_Click
   
    If EditText1.Text = " " Then
    Msgbox ("Please Enter a Serial Number", "360" )
    End If

    File.WriteString(File.DirDefaultExternal, EditText1.Text & ".txt" ,  txtLog.Text)
    Msgbox ("Info Saved", "360")
   
    End Sub

In the Old VB6 Days I could use the following:

If Len(edittextbox1.Text) = 0 Then
Msgbox ("Please Enter a Serial Number", "360" )
Exit Sub
End If

Any ideas on how we can do this?
 

Star-Dust

Expert
Licensed User
Longtime User
B4X:
Sub Button1_Click
  
    If EditText1.Text.Trim= "" Then
        Msgbox ("Please Enter a Serial Number and Click Ok", "360" )
    Else
        File.WriteString(File.DirDefaultExternal, EditText1.Text & ".txt" ,  txtLog.Text)
        ToastMessageShow ("Info Saved", False)
    End If
      
End Sub
 
Upvote 0
Top