Public Class Form1
Dim X1, X9, total, c As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If TextBox2.Text = "1" Or TextBox2.Text = "2" Then
Else
MsgBox("第二個欄位必需為 1 or 2")
End If
If TextBox1.Text = "A" Then
X1 = 1
X9 = 0
End If
If TextBox1.Text = "B" Then
X1 = 1
X9 = 0
End If
If TextBox1.Text = "D" Then
X1 = 1
X9 = 0
End If
If TextBox1.Text = "F" Then
X1 = 1
X9 = 0
End If
If TextBox1.Text = "A" Or TextBox1.Text = "B" Or TextBox1.Text = "D" Or TextBox1.Text = "F" Then
Else
MsgBox("第一欄必需為 A,B,D,F")
End If
total = X1 * 1 + X9 * 9 + Val(TextBox2.Text * 8) + Val(TextBox3.Text * 7) + Val(TextBox4.Text * 6) + Val(TextBox5.Text * 5) + Val(TextBox6.Text * 4) + Val(TextBox7.Text * 3) + Val(TextBox8.Text * 2) + Val(TextBox9.Text * 1)
c = total Mod 10
Label3.Text = 10 - c
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
End Class