求助,帮忙看哈该杂办?
[bo]这是一个身份证末位校验码验证程序代码,请问大侠们怎样实现点击输入框的取消按钮后回到初始界面啊?谢谢!![/bo]Private Sub Command1_Click()
Label2.Caption = ""
Label1.Caption = ""
retry:
s = InputBox("请输入身份证号码的前17位:", "提示", , 4000, 5000)
Dim a(17)
For i = 1 To 17
a(i) = Mid(s, 18 - i, 1)
Next i
'以下4行是规定输入年份只能是19**和20**年的形式
If Mid(s, 7, 2) <> 19 And Mid(s, 7, 2) <> 20 Then
mes = MsgBox("你输入的身份证号码是非法的!" & Chr(10) & "请重新输入!", 52, "错误提示")
If mes = 7 Then
End
Else
Label2.Caption = ""
Label1.Caption = ""
GoTo retry
End If
End If
'以下4行是规定输入月份只能是1-12
If Mid(s, 11, 2) > 12 Or Mid(s, 11, 2) = 0 Then
mes = MsgBox("你输入的身份证号码是非法的!" & Chr(10) & "请重新输入!", 52, "错误提示")
If mes = 7 Then
End
Else
Label2.Caption = ""
Label1.Caption = ""
GoTo retry
End If
End If
'以下4行是规定输入天数只能是1-31
If Mid(s, 13, 2) > 31 Or Mid(s, 13, 2) = 0 Then
mes = MsgBox("你输入的身份证号码是非法的!" & Chr(10) & "请重新输入!", 52, "错误提示")
If mes = 7 Then
End
Else
Label2.Caption = ""
Label1.Caption = ""
GoTo retry
End If
End If
Label2.Caption = "你输入的身份证号码前17位是:" & s
m = 2 * a(1) + 4 * a(2) + 8 * a(3) + 5 * a(4) + _
10 * a(5) + 9 * a(6) + 7 * a(7) + 3 * a(8) + _
6 * a(9) + 1 * a(10) + 2 * a(11) + 4 * a(12) + _
8 * a(13) + 5 * a(14) + 10 * a(15) + 9 * a(16) + 7 * a(17)
n = m Mod 11
If n = 0 Then
h = 1
ElseIf n = 1 Then
h = 0
ElseIf n = 2 Then
h = "X"
Else: h = 12 - n
End If
If h = "X" Then
Label1.Caption = "你的身份证号码的最后一位数字是:" & "X"
Else
Label1.Caption = "你的身份证号码的最后一位数字是:" & Str(h)
End If
Command1.Caption = "重新计算"
End Sub