'Function To Check EIN Validity
Public Function ValidatePhone(ByVal strEINNum As String) As Boolean
'Dim EINValid As String = Nothing
''Create Reg Exp Pattern
'Dim strEINPattern As String = "'^\d{2}\-?\d{7}$"
Dim strEINPattern As String = "^[1-9]\d?-\d{7}$"
'Create Reg Ex Object
Dim reEIN As New Regex(strEINPattern)
'Something Typed In
If Not String.IsNullOrEmpty(strEINNum) Then
EINValid = reEIN.IsMatch(strEINNum) 'Check Validity
Else
EINValid = False 'Not Valid / Empty
End If
Return EINValid 'Return True / False
End Function
No comments:
Post a Comment