Figure 1 - These objects will determine if all our data is valid or not. Clear() 'Clear Text Box Name Valid = False 'Boolean = False Else Name Valid = True 'Everything Fine End If End Sub Easy one to start with. Focus() 'Set Focus To Text Box End If End Sub Private Sub txt Email_Lost Focus(sender As Object, e As System. Lost Focus Validate Email() 'Check Email Validity End Sub The expression may look horrible to the layman's eye, but look closer. To check if the user has entered an email that actually exists, you will have to find a different way such as to send a of some sorts.
Empty Dim The Field As Text Box Base = CType(sender, Text Box Base) If Type Of The Field Is Masked Text Box Then CType(The Field, Masked Text Box). Exclude Prompt And Literals End If If Not Is Valid(The Field, Error Message) Then e. Well, sometimes a good structured and thought out If statement can suffice, but it can become quite long and cumbersome in the future. By using Regular Expressions this way, you can reduce the chances of getting errors at erratic times. This sub checks the email's format and if it thinks that it matches, it returns True and vice versa.Also, the more tests you are performing, the slower your app might become. For more information regarding Regular Expressions, you are welcome to look at these two MSDN articles: Because it is always easy to learn by doing things practically, you will be creating an app that makes use of Regular Expressions to determine valid input. NET application and design the form to resemble Figure 1. Obviously this only works for the formatting of the email. I was working on this for hours and didn't even notice that small change. So, if all required fields have a value and you click the Save button, the information needs to be put into a database.The validation control classes are inherited from the Base Validator class hence they inherit its properties and methods.It has the "Auto Validate" option set to "Enable Allow Focus Change".