0

Public Sub ValidateID(ByVal IDno As String)

Dim a As Integer = 0
For i As Integer = 0 To 5
a += CInt(ID.Substring(i * 2, 1))
Next

Dim b As Integer = 0
For i As Integer = 0 To 5
b = b * 10 + CInt(ID.Substring(2 * i + 1, 1))
Next
b *= 2
Dim c As Integer = 0
Do
c += b Mod 10
b = CInt(Int(b / 10))
Loop Until b <= 0
c += a
Dim d As Integer = 0
d = 10 - (c Mod 10)
If (d = 10) Then d = 0
If (d = CInt(mID.Substring(12, 1))) And (IsDate("19" & mID.Substring(0, 2) & "/" & mID.Substring(2, 2) & "/" & mID.Substring(4, 2)) Or IsDate("20" & mID.Substring(0, 2) & "/" & mID.Substring(2, 2) & "/" & mID.Substring(4, 2))) Then

MessageBox.Show("Invalid ID number")

Else
ID = InputBox("Enter the Identity Number of the parrot")

End If

End Sub 'Validate

Public Sub ValidateID(ByVal IDno As String)

        Dim a As Integer = 0
        For i As Integer = 0 To 5
            a += CInt(ID.Substring(i * 2, 1))
        Next

        Dim b As Integer = 0
        For i As Integer = 0 To 5
            b = b * 10 + CInt(ID.Substring(2 * i + 1, 1))
        Next
        b *= 2
        Dim c As Integer = 0
        Do
            c += b Mod 10
            b = CInt(Int(b / 10))
        Loop Until b <= 0
        c += a
        Dim d As Integer = 0
        d = 10 - (c Mod 10)
        If (d = 10) Then d = 0
        If (d = CInt(mID.Substring(12, 1))) And (IsDate("19" & mID.Substring(0, 2) & "/" & mID.Substring(2, 2) & "/" & mID.Substring(4, 2)) Or IsDate("20" & mID.Substring(0, 2) & "/" & mID.Substring(2, 2) & "/" & mID.Substring(4, 2))) Then

            MessageBox.Show("Invalid ID number")

        Else
            ID = InputBox("Enter the Identity Number of the parrot")

        End If

    End Sub 'Validate
2
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by s.chauke
0

I'm not sure what exactly your question is here? Also can you give more details about the id number itself and what your trying to accomplish? Is this a barcode?

One suggestion right off the top is to change this into a Function to return true if valid and false if not.

0

I am trying to validate A property method, of the 13 digits bar code!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.