你把textbox4换成一个标签控件label1,然后粘贴下面的代码
Dim 验证码
Private Sub CommandButton1_Click()
If TextBox1.Text = "long" And TextBox2.Value = "2008" And TextBox3.Value = Label1.Caption Then
MsgBox "登陆成功"
Else
MsgBox "登陆失败"
End If
Stop
End Sub
Private Sub CommandButton2_Click()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
End Sub
Private Sub Label1_Click()
生成验证码
End Sub
Private Sub UserForm_Initialize()
生成验证码
End Sub
Sub 生成验证码()
验证码 = Int(Rnd() * 9000 + 1000)
Label1.Caption = 验证码
End Sub
你把textbox4换成一个标签控件label1,然后粘贴下面的代码
Dim 验证码
Private Sub CommandButton1_Click()
If TextBox1.Text = "long" And TextBox2.Value = "2008" And TextBox3.Value = Label1.Caption Then
MsgBox "登陆成功"
Else
MsgBox "登陆失败"
End If
Stop
End Sub
Private Sub CommandButton2_Click()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
End Sub
Private Sub Label1_Click()
生成验证码
End Sub
Private Sub UserForm_Initialize()
生成验证码
End Sub
Sub 生成验证码()
验证码 = Int(Rnd() * 9000 + 1000)
Label1.Caption = 验证码
End Sub