Imports System.Text.RegularExpressions
Public Class frm
Private Sub ERROR(ByVal sender As Object, ByVal e As System.EventArgs) Handles tx.Validated, txt.Validated, txt.Validated
Dim ctlA As Control
ctlA = CType(sender, Control)
erprvdStraat.SetError(ctlA, String.Empty)
End Sub
Private Sub ControleOpLeeg(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txt.Validating, txt.Validating, txt.Validating
Dim ctlA As Control
ctlA = CType(sender, Control)
If ctlA.Text.Trim = String.Empty Then
e.Cancel = True
erprvdA.SetError(ctlA, "ERROR")
End If
End Sub
Private Sub txt_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txt.Validating
Dim ctlSender As Control
ctlA = CType(sender, Control)
If Not System.Text.RegularExpressions.Regex.IsMatch(ctlA.Text.Trim, "\d\d\d\d") Then
e.Cancel = True
erprvd.SetError(ctlA, "ERROR")
End If
End Sub
End Class