B4J Question Fix me my warning #2

universengo

Member
My code is as below:
B4X:
Sub txtAreaNull (txtLM As TextArea, tb As String) As Boolean
    Dim tNull As Boolean = False
    If txtLM.Text="" Then
        fx.Msgbox(Main.MainForm,tb,"Warning!")
        txtLM.RequestFocus
        tNull = True
        Return tNull
    End If
End Sub

The log is
Not all code paths return a Value. (warning #2)

Nobody help me to fix this error.
Thanks.
 

Tayfur

Well-Known Member
Licensed User
Longtime User
B4X:
Sub txtAreaNull (txtLM As TextArea, tb As String) As Boolean
    Dim tNull As Boolean = False
    If txtLM.Text="" Then
        fx.Msgbox(Main.MainForm,tb,"Warning!")
        txtLM.RequestFocus
        tNull = True
        Return tNull
    End If
    Return tNull
End Sub
 
Upvote 0

universengo

Member
B4X:
Sub txtAreaNull (txtLM As TextArea, tb As String) As Boolean
    Dim tNull As Boolean = False
    If txtLM.Text="" Then
        fx.Msgbox(Main.MainForm,tb,"Warning!")
        txtLM.RequestFocus
        tNull = True
        Return tNull
    End If
    Return tNull
End Sub
That is perfect!
Thank Tayfur so much.
 
Upvote 0
Top