在CSDN上献丑一回,希望能帮助一些对初学习VB的朋友们。
首先我们先来看一个例子,我想这个问题就不难理解了!
’代码开始——————————————————————————————————————————
Private Sub Command1_Click()
If Text2.Text <> "" And Text4.Text <> "" Then
MsgBox "密码正确!欢迎使用。",64,"提示"
Unload Me
Else
MsgBox "用户名或密码不正确!请重新输入。",vbCritical,"错误"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Exit Sub
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Form1.Caption = "text的passwordChar属性对比"
Frame1.Caption = "passwordChar属性未设置"
Frame2.Caption = "passwordChar属性设置未*"
Command1.Caption = "登陆"
Command2.Caption = "退出"
Label1.Caption = "用户名"
Label2.Caption = "密码"
Text1.Text = "admin"
Text2.Text = ""
Text2.PasswordChar = ""
Label3.Caption = "用户名"
Label4.Caption = "密码"
Text3.Text = "admin"
Text4.Text = ""
Text4.PasswordChar = "*"
End Sub
'这里我们以 用户名:admin 登陆密码:123456 为例子进行演示!
———————————————————————————————————————————————
注:以上代码在xp下测试通过!
_______________________________________________________________________