,把文本框的PasswordChar属性设置为“*”,把3个命令按钮的标题分别设置为“开始”、“检查口令”和“结束”。程序运行后,单击第一个命令按钮,清除文本框中的信息,并把光标移到文本框中,接着在文本框中输入口令,然后单击第2个按钮,检查输入的口令是否正确。如果正确,则在图片框中显示一个图形,否则显示一个信息框,要求重新输入,此时将调用第1个按钮的Click事件过程,再一次在文本框中输入口令,直到输入正确的口令为止。如果单击“结束”按钮,则结束程序。
Private Sub Command1_Click()
If Text1.Text = "123" Then '口令
MsgBox "口令确认!", 44, "提示"
Image1.Picture = LoadPicture("图片路径")
Else
MsgBox "口令错误!", 64, "提示"
Text1.Text = ""
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Text1.SetFocus
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text1.PasswordChar = "*"
Command1.Caption = "确定"
Command2.Caption = "退出"
Command3.Caption = "开始"
End Sub
If Text1.Text = "123" Then '口令
MsgBox "口令确认!", 44, "提示"
Image1.Picture = LoadPicture("图片路径")
Else
MsgBox "口令错误!", 64, "提示"
Text1.Text = ""
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Text1.SetFocus
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text1.PasswordChar = "*"
Command1.Caption = "确定"
Command2.Caption = "退出"
Command3.Caption = "开始"
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答 2012-11-01
练习?