vb程序设计登录程序:在窗体的文本框中输入密码。

2025-02-25 10:40:02
推荐回答(3个)
回答1:

'2个窗体(form1,form2) 2个textbox(text1,text2) 1个commandbutton (command1)
'text1 为账号框,text2为密码框,command1为登录按钮

Dim cCount As Long
Private Sub Command1_Click()
If LCase(Text1.Text) = "abc" And Text2.Text = "123" Then'账号abc(不区分大小写) ,密码123
cCount = 1
Form2.Show
'Unload Me
Else
If cCount = 3 Then
MsgBox "密码不正确且密码3次错误"
Unload Me
Else
MsgBox "密码不正确"
cCount = cCount + 1
End If
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text2.PasswordChar = "*"
cCount = 1
End Sub

回答2:

你是要程序?

回答3:

这个简单啊
在PasswordChar属性后面输入想要显示的样子就可以了