Dim vCode As String
Private Sub Command1_Click()
drawvc
End Sub
Private Sub drawvc() '显示校验码
Dim i,vc,px,py As Long
Dim r,g,b As Byte
Randomize '初始化随机种子
'生成随机校验码
vc = CLng(8999 * Rnd + 1000)
vCode = vc
'显示校验码
Picture1.Cls
Picture1.Print vc
'添加噪点(防止自动图像识别)
For i = 0 To 2000 '画2000个噪点
'画点随机位置
px = CLng(Picture1.Width * Rnd)
py = CLng(Picture1.Height * Rnd)
'画点随机颜色
r = CByte(255 * Rnd)
g = CByte(255 * Rnd)
b = CByte(255 * Rnd)
Picture1.Line (px,py)-(px + 1,py + 1),RGB(r,b)
Next
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Picture1.FontSize = 12
Picture1.FontBold = True
Picture1.AutoRedraw = True
drawvc
End Sub
Private Sub Command2_Click()
Adodc1.RecordSource = "select * from useri where id='" & Text1.Text & "' and password='" & Text2.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 And Text3.Text = vCode Then
MsgBox ("登陆成功")
ElseIf Text1.Text = "" Then
MsgBox ("用户名不能为空!"),vbOKOnly + vbInformation,"警告"
ElseIf Text2.Text = "" Then
MsgBox ("密码不能为空!"),"警告"
ElseIf Text3.Text = "" Then
MsgBox ("请输入验证码!"),"警告"
Else
End If
End Sub
Private Sub Command3_Click()
End
End Sub
哪位高手帮我看看错在哪????
急用!!!!!!!
原文链接:https://www.f2er.com/vb/261218.html