VB中如何实现用户登陆界面

来源:百度知道 编辑:UC知道 时间:2024/05/14 00:58:26
要求不输入用户名和密码不能登陆!
输入后点登陆弹出对话框

if text1.text="" then
msgbox "账号名不能为空",vbokonly+32,""
else
if text1.text="" then
msgbox "密码不能为空",vbokonly+32,""
else
unload me
form2.show

sub form_load()
if inputbox("请输入密码:") <> "123456" then
msgbox "密码错误!"
end
end if
end sub

用这个试试看哦!if text1.text="" then
msgbox "账号名不能为空",vbokonly+32,""
else
if text1.text="" then
msgbox "密码不能为空",vbokonly+32,""
else
unload me
form2.show

sub command1_click()
if inputbox("请输入密码:") <> "123456" then
msgbox "密码错误!"
end
end if
end sub

不行啊!
说缺少if什么

把文字框动态生成,不用你设计控件了,呵呵
把以下代码直接粘到窗体的代码窗,OK!

Dim WithEvents txT1 As TextBox, WithEvents txT2 As TextBox, WithEvents cmD As CommandButton
<