[SIZE=2][COLOR=#0000ff]Public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] Modulus11([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] DigitType [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Byte[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] txtISBN [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] tmpNumber, NewNumber, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, Asum, Bsum, Csum, Dsum, Esum[/SIZE]
[SIZE=2]tmpNumber = Trim(txtISBN) [/SIZE][SIZE=2][COLOR=#008000]'Calculating the eaiting factor[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[SIZE=2]A1 = Mid(tmpNumber, 1, 1) * 10[/SIZE]
[SIZE=2]A2 = Mid(tmpNumber, 2, 2) * 9[/SIZE]
[SIZE=2]A3 = Mid(tmpNumber, 3, 3) * 8[/SIZE]
[SIZE=2]A4 = Mid(tmpNumber, 4, 4) * 7[/SIZE]
[SIZE=2]A5 = Mid(tmpNumber, 5, 5) * 6[/SIZE]
[SIZE=2]A6 = Mid(tmpNumber, 6, 6) * 5[/SIZE]
[SIZE=2]A7 = Mid(tmpNumber, 7, 7) * 4[/SIZE]
[SIZE=2]A8 = Mid(tmpNumber, 8, 8) * 3[/SIZE]
[SIZE=2]A9 = Mid(tmpNumber, 9, 9) * 2[/SIZE]
[SIZE=2]A10 = Mid(tmpNumber, 10, 10) * 1[/SIZE]
[SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] InvalidCastException[/SIZE]
[SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[SIZE=2]Asum = A1 + A2 + A3 + A4 + A5 + A6 + A7 + A8 + A9 + A10[/SIZE]
[SIZE=2]Bsum = Asum [/SIZE][SIZE=2][COLOR=#0000ff]Mod[/COLOR][/SIZE][SIZE=2] 11 [/SIZE][SIZE=2][COLOR=#008000]'Reminder[/COLOR][/SIZE]
[SIZE=2]Csum = 11 - Bsum[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] Csum = 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]MsgBox("valid ISBN")[/SIZE]
[SIZE=2][COLOR=#0000ff]Else[/COLOR][/SIZE]
[SIZE=2]MsgBox("Invalid")[/SIZE]
[SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE]