Tuesday, April 29, 2025

Function To Check EIN Validity

     '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


Append Incremental alphabets in end vb.net

 



 Public Function incrementChar(ByVal count As Integer) As String

'Dim count As Integer

      Dim MyLet As Integer, j As Integer = 0, i As Integer = 0

      Dim updatedDate As String = DateTime.Now().ToString("MM.dd.yy")

      Dim ChkNum As String = ""

      For i = 0 To count

          If i < 26 Then

              MyLet = 65

             ChkNum = "ACH " & updatedDate & " " & Char.ConvertFromUtf32(i + MyLet)

Else If i >= 26 And i < count Then

              MyLet = 65

              ChkNum = "ACH " & updatedDate & " " & Char.ConvertFromUtf32(j + MyLet) & Char.ConvertFromUtf32(j + MyLet)             

              j += 1

          End If

      Next

      Return ChkNum

  End Function







    Public Function incrementChar() As String

        Dim MyLet As Integer, j As Integer = 0, i As Integer = 0

        Dim updatedDate As String = DateTime.Now().ToString("MM.dd.yy")

        Dim ChkNum As String = ""

        For i = 0 To 36

            'Console.WriteLine("i: " & i.ToString())

            If i < 26 Then

                MyLet = 65

                ChkNum = "ACH " & updatedDate & " " & Chr(i + MyLet)

                Console.WriteLine(ChkNum)

            ElseIf i >= 26 And i < 36 Then

                MyLet = 65

                ChkNum = "ACH " & updatedDate & " " & Chr(j + MyLet) & Char.ConvertFromUtf32(j + MyLet)

                Console.WriteLine(ChkNum)

                j += 1

            End If

        Next

        Return ChkNum

    End Function

End Module