帮忙做个一个很简单的VB用户名密码登陆程序。内有详细...

这个号没钱了。希望有好心人帮帮忙,之后必有答谢
2025-05-23 15:09:51
推荐回答(3个)
回答1:

Private Sub Command1_Click()
If Text1.Text = "abc" And Text2.Text = "123" Then '自己改姓名和学号
MsgBox "欢迎你"
Else
MsgBox "非法用户"
End If
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub

Private Sub Form_Load()
Label1.Caption = "&User"
Label2.Caption = "&Password"
Command1.Caption = "确定[&E]"
Command2.Caption = "取消[&S]"
Text1.Text = ""
Text2.Text = ""
End Sub

回答2:

Option Explicit
Private Sub Command1_Click()
If Text1 = "zhangsan" And Text2 = "12" Then
MsgBox "欢迎你", vbInformation
Else
MsgBox "非法用户", vbInformation
End If
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
Label1.Caption = "&User"
Label2.Caption = "Password"
Command1.Caption = "确定(&E)"
Command2.Caption = "取消(&S)"
Text1 = ""
Text2 = ""
End Sub

回答3:

Private Sub Command1_Click()
If Text1.Text = "001" And Text2.Text = "100" Then '自己改姓名和学号
form2.show
unload me
Else
MsgBox "用户或密码错误,请从新输入"
text1.text=""
text2.text=""
End If
end sub
Private Sub Form_Load()
Label1.Caption = "&User"
Label2.Caption = "&Password"
Command1.Caption = "确定[&E]"
Command2.Caption = "取消[&S]"
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command2_Click()
end
End Sub