universengo Member Jun 19, 2019 #1 My code is as below: Code: Copy 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) Click to expand... Nobody help me to fix this error. Thanks.
My code is as below: Code: Copy 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) Click to expand... Nobody help me to fix this error. Thanks.
Tayfur Well-Known Member Licensed User Longtime User Jun 19, 2019 #2 Code: Copy 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
Code: Copy 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
josejad Expert Licensed User Longtime User Jun 19, 2019 #3 https://www.b4x.com/android/forum/threads/not-all-code-paths-return-a-value.77062/ If txtLM.Text is not "", then you don't return a value, but it's just a warning. Upvote 0
https://www.b4x.com/android/forum/threads/not-all-code-paths-return-a-value.77062/ If txtLM.Text is not "", then you don't return a value, but it's just a warning.
universengo Member Jun 19, 2019 #4 Tayfur said: Code: Copy 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 Click to expand... That is perfect! Thank Tayfur so much. Upvote 0
Tayfur said: Code: Copy 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 Click to expand... That is perfect! Thank Tayfur so much.
universengo Member Jun 19, 2019 #5 José J. Aguilar said: https://www.b4x.com/android/forum/threads/not-all-code-paths-return-a-value.77062/ If txtLM.Text is not "", then you don't return a value, but it's just a warning. Click to expand... My new code. Code: Copy Sub txtAreaNull (txtLM As TextArea, tb As String) As Boolean If txtLM.Text="" Then fx.Msgbox(Main.MainForm,tb,"Warning!") txtLM.RequestFocus Return True Else Return False End If End Sub Fixed a warning #2 Upvote 0
José J. Aguilar said: https://www.b4x.com/android/forum/threads/not-all-code-paths-return-a-value.77062/ If txtLM.Text is not "", then you don't return a value, but it's just a warning. Click to expand... My new code. Code: Copy Sub txtAreaNull (txtLM As TextArea, tb As String) As Boolean If txtLM.Text="" Then fx.Msgbox(Main.MainForm,tb,"Warning!") txtLM.RequestFocus Return True Else Return False End If End Sub Fixed a warning #2