pls help me abt this code wht is working of that code

tabish8612

Member
Joined
Jan 15, 2009
Messages
6
Programming Experience
Beginner
VB.NET:
Function validateIDNo(ByVal IDNo As String) As Boolean
        Try
            ' Algorithim Step 1
            Dim a As Integer = 0
            For i As Integer = 0 To 5
                a += CInt(IDNo.Substring(i * 2, 1))
            Next
            ' Algorithim Step 2 & 3
            Dim b As Integer = 0
            For i As Integer = 0 To 5
                b = b * 10 + CInt(IDNo.Substring(2 * i + 1, 1))
            Next
            b *= 2
            ' Algorithim Step 4
            Dim c As Integer = 0
            Do
                c += b Mod 10
                b = Int(b / 10)
            Loop Until b <= 0
            ' Algorithim Step 5
            c += a
            Dim d As Integer = 0
            d = 10 - (c Mod 10)
            If (d = 10) Then d = 0
            If d = CInt(IDNo.Substring(12, 1)) Then
                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            Return False
        End Try
    End Function
 
Last edited by a moderator:
First up, I've moved your thread from the VS.NET General forum, which is for general discussion regarding the VS IDE, to the VB.NET General forum, which is for general discussion regarding the VB language.

Secondly, I've added CODE tags to your post. It would be appreciated if you could do so for all code snippets in future. It makes code much more readable.

Finally, you have posted your code but you haven't actually asked a question. "please help me with this code" is not nearly specific enough. Please tell us what you're trying to achieve and what goes wrong when you run that code, including error messages. Only if we know what problem we're trying to solve can we possibly solve it.
 
Back
Top