Private Sub Command1_Click()
X1 = Form1.Text2.Text
X2 = Form1.Text1.Text
If Len(X1) > 0 Then
a = 1
End If
If Len(X2) = 20 Then
c = 1
End If
For i = 1 To Len(X2)
If Asc(Mid(X2, i, 1)) >= 48 And Asc(Mid(X2, i, 1)) < 57 Then
b = 1
Else
b = 0
Exit For
End If
Next
If a = 1 And b = 1 And c = 1 Then
Call check
End If
End Sub
Sub check()
X1 = Form1.Text2.Text
X2 = Form1.Text1.Text
For i = 1 To Len(X2)
z = z + Asc(Mid(X2, i, 1))
Next
For i = 1 To Len(X1)
zz = zz + Asc(Mid(X1, i, 1))
Next
帮你整理一下, 乱了点,呵呵
Private Sub Command1_Click()
X1 = Form1.Text2.Text
X2 = Form1.Text1.Text
If Len(X1) > 0 Then
a = 1
End If
If Len(X2) = 20 Then
c = 1
End If
For i = 1 To Len(X2)
If Asc(Mid(X2, i, 1)) >= 48 And Asc(Mid(X2, i, 1)) < 57 Then
b = 1
Else
b = 0
Exit For
End If
Next
If a = 1 And b = 1 And c = 1 Then
Call check
End If
End Sub
Sub check()
X1 = Form1.Text2.Text
X2 = Form1.Text1.Text
For i = 1 To Len(X2)
z = z + Asc(Mid(X2, i, 1))
Next
For i = 1 To Len(X1)
zz = zz + Asc(Mid(X1, i, 1))
Next
yyy = Mid(X2, 1, 1) + Mid(X2, 4, 1) + Mid(X2, 6, 1) + Mid(X2, 9, 1) + Mid(X2, 11, 1) + Mid(X2, 14, 1) + Mid(X2, 15, 1) + Mid(X2, 16, 1)
' 1\4\6\9\11\14\15\16
zzz = Mid(X2, 12, 1) + Mid(X2, 13, 1) + Mid(X2, 10, 1) + Mid(X2, 7, 1) + Mid(X2, 8, 1) + Mid(X2, 3, 1) + Mid(X2, 5, 1) + Mid(X2, 2, 1)
'12\13\10\7\8\3\5\2
yy = Val(yyy)
zz = Val(zzz)
xx = yy * 2 - 10000 + 5 * zz
cc = 317799897
ww = yy Xor cc Xor zz
If ww = xx Then
b1 = 1
End If
x3 = Mid(X2, 16, 5)
yy = Val(x3)
xx = yy * 6 + 12345
cc = 271360
ww = yy Xor cc
If ww = xx Then
b2 = 1
End If
If b1 = 1 And b2 = 1 Then
Form1.Text2.Text = ""
Form1.Text1.Text = ""
Command1.Visible = False
Form1.Label5.Caption = "验证通过"
End If
End Sub