I am trying to create a one line empty string validation Public Function but am yet to achieve this aim.
The deal is to use a Public Function to test the string and exit the sub-routine that called on the function but so far, I can test for empty string but not exit the sub-routine.
Codes for far...
Public Class Validator Public Function isEmpty(ByVal fieldData, ByVal fieldName) If fieldData = "" Then MsgBox("Enter " & fieldName & "!") Exit Function Else Return fieldData End If End Function End Class And to use it, I want something like this...
Dim surname as string surname= isEmpty(txtSurname.text, "Surname") This checks correctly, but how can I exit the sub-routine?
Thanks in advance