1Imports System.Text.RegularExpressions
2
3
4 Private Sub txtJobDate_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtJobDate.Leave
5 Try
6 Dim re As String = "^\d{1,2}\/\d{1,2}\/\d{4}$"
7 Dim coDate As String = txtJobDate.Text.Trim()
8
9 If Not Regex.IsMatch(coDate, re) Then
10 MsgBox("NO THAT IS NOT A VALID DATE!!! - use MM/DD/YYYY", MsgBoxStyle.Critical)
11 txtJobDate.Text = ""
12 txtJobDate.Focus()
13 Exit Sub
14 End If
15 Catch ex As Exception
16 MsgBox("OOps: " & vbCrLf & ex.Message)
17 End Try
18 End Sub