Can Anyone Explain Me about This Code

validateidno , help , code Pakistan
  • 10 years ago
    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 pls give explaination abt this code i really want to show the assignment to my teacher on Monday

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but 'That's funny...'” - Isaac Asimov