Dim a(10) As Integer
Dim i, j, k, b, c, tot, f, s As Integer
a(8) = Val(TextBox2.Text)
a(7) = Val(TextBox3.Text)
a(6) = Val(TextBox4.Text)
a(5) = Val(TextBox5.Text)
a(4) = Val(TextBox6.Text)
a(3) = Val(TextBox7.Text)
a(2) = Val(TextBox8.Text)
a(1) = Val(TextBox9.Text)
If TextBox1.Text = "A" Or TextBox1.Text = "a" Then
k = 0
b = 1
End If
If TextBox1.Text = "B" Or TextBox1.Text = "b" Then
k = 1
b = 1
End If
If TextBox1.Text = "C" Or TextBox1.Text = "c" Then
k = 2
b = 1
End If
If TextBox1.Text = "D" Or TextBox1.Text = "d" Then
k = 3
b = 1
End If
If TextBox1.Text = "E" Or TextBox1.Text = "e" Then
k = 4
b = 1
End If
If TextBox1.Text = "F" Or TextBox1.Text = "f" Then
k = 5
b = 1
End If
If TextBox1.Text = "S" Or TextBox1.Text = "s" Then
k = 6
b = 2
End If
c = b * 1 + k * 9
For i = 8 To 1 Step -1
j = j + a(i) * i
Next
tot = c + j
f = tot Mod 10
s = 10 - f
If TextBox10.Text = s Then
MsgBox("ID正確")
Else
MsgBox("ID錯誤,正確為" & TextBox1.Text & TextBox2.Text & TextBox3.Text & TextBox4.Text & TextBox5.Text & TextBox6.Text & TextBox7.Text & TextBox8.Text & TextBox9.Text & s)
End If