Validating event net
That sollution is still partial in this newsgroup on 29-8 too but only some end thread OT discussion.I thougth it would stay, so I could find it on Google, but someone has cleaned it up.
Add the following inside your name Textbox's Leave event: Private Sub txt Name_Leave(sender As Object, e As System. Leave 'If Not A Matching Format Entered If Not Regex. If you are uncertain about the pattern I supplied, have a look here. Just a note, some surnames contain spaces and even hyphens. Sometimes there are even brackets surrounding the code. None Exit For End If End If Next Note this version does not validate controls nested within other container controls, such as Group Boxes, I would include the above in a recursive subroutine.However you can in my opinion for ever do (not tested) sub Button Click event textbox1_validating(textbox1,nothing) textbox2_validating(textbox2,nothing) etc. They make use of a pattern matching system to match the input with a certain pattern of data.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.