Option Explicit Const password1 = "12345678" Const password2 = "87654321"Public LoginSucceeded As Boolean Private Sub cmdOK_Click() '检查正确的密码 If txtPassword = password1 Or txtPassword = password2 Then Form1.Show LoginSucceeded = True Me.Hide Else MsgBox "无效的密码,请重试!", , "登录" txtPassword.SetFocus SendKeys "{Home}+{End}" End If End Sub
Const password1 = "12345678"
Const password2 = "87654321"Public LoginSucceeded As Boolean
Private Sub cmdOK_Click()
'检查正确的密码
If txtPassword = password1 Or txtPassword = password2 Then
Form1.Show
LoginSucceeded = True
Me.Hide
Else
MsgBox "无效的密码,请重试!", , "登录"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub