Option Explicit
Private Sub Command1_Click()
Text1.Text = ""
Label2.Visible = False
Command2.Enabled = False
Text1.Enabled = True
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Command2.Enabled = False
Label2.Visible = True
Text1.Enabled = False
If Text1.Text = "123456" Then
Label2.ForeColor = vbBlue
Label2.Caption = "欢迎进入vb程序!"
Command1.Enabled = False
Else
Label2.ForeColor = vbRed
Label2.Caption = "密码错误!"
End If
End Sub
Private Sub Form_Load()
Label1.Caption = "请输入密码" & Chr(13) & "(最多输六个字)"
Text1.Text = ""
Text1.PasswordChar = "*"
Command1.Visible = False
Command2.Enabled = False
Label2.Visible = False
End Sub
Private Sub Text1_Change()
Command1.Visible = True
Command2.Enabled = True
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Label2.Visible = False
Command2.Enabled = False
Text1.Enabled = True
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Command2.Enabled = False
Label2.Visible = True
Text1.Enabled = False
If Text1.Text = "123456" Then
Label2.ForeColor = vbBlue
Label2.Caption = "欢迎进入vb程序!"
Command1.Enabled = False
Else
Label2.ForeColor = vbRed
Label2.Caption = "密码错误!"
End If
End Sub
Private Sub Form_Load()
Label1.Caption = "请输入密码" & Chr(13) & "(最多输六个字)"
Text1.Text = ""
Text1.PasswordChar = "*"
Command1.Visible = False
Command2.Enabled = False
Label2.Visible = False
End Sub
Private Sub Text1_Change()
Command1.Visible = True
Command2.Enabled = True
End Sub