请教各位,小弟写了一个程序
里面需要用到一个密码登陆窗体.
源码:
Private Sub Command1_Click()
Form2.Show
End Sub在Form2里有个text1 和 text2
用来输入用户名和密码,当用户名和密码正确后.点击commnad1后直接打开form3
(最好是源码...,小弟巨菜)
谢谢了.
里面需要用到一个密码登陆窗体.
源码:
Private Sub Command1_Click()
Form2.Show
End Sub在Form2里有个text1 和 text2
用来输入用户名和密码,当用户名和密码正确后.点击commnad1后直接打开form3
(最好是源码...,小弟巨菜)
谢谢了.
解决方案 »
- 变量的作用域问题, 想不通...
- EXCEL中的宏使用
- 如何用vb实现将远程sql2000数据库中的一个表下载到本机中使用
- 今天笔试的一道变态VB题,BS出题者!
- web browser控件的DocumentComplete和DownloadComplete有什么区别?
- 请回复“怎样把文本框的 PasswordChar 属性设置成像“●”这样的特殊字符?”这个帖子的朋友来领分
- 从一个FORM来更新另一个FORM的局部文本框???
- 多表查询不能使用SUM子句?
- 为什么我的模拟鼠标左键单击事件总出错?
- 如何安装msi文件,我需要安装什么软件呢我手头没有office2000
- 请教高手们一个问题。
- 软件打包后出现的问题
if acCheckUser=0 then
form3.show
unload me
else
msgbox "用户名或密码错误!"
end if
end subPrivate Function acCheckUser() As Integer
On Error GoTo Errs
Dim Sql As String
Dim sPass As String, sName As String
sPass = Me.txtPass.Text
sName=me.txtName.text
Sql = "select zlUser_Pass from zlUser where zlUser_Name='" & sName & "'"
adoRs.Open Sql, adoCn, 1, 3
If adoRs.RecordCount = 1 Then
If sPass = Trim(adoRs("zlUser_Pass")) Then
acCheckUser = 0
Else
acCheckUser = -1
End If
Else
acCheckUser = -1
End If
adoRs.Close
Exit Function
Errs:
MsgBox Err.Description
acCheckUser = -1
End Function
密码假设为 当用户为user 密码为123 就好了
确定后直接关闭form2
谢谢
If Text1.Text = "user"
Text2.Text = "123" 时,弹出form2请问格式错了么?还是其他的啊??
他总是弹出对话框:Name or Password Error !
我没有输错啊.....
谢谢了~~~
Private Sub Command1_Click()
If Text1.Text = "user" + Text2.Text = "123" Then
Form2.Show
Else
Call MsgBox("Name or Password Error !", vbOKOnly + 48, "WARNING !")
End If
End Sub
或者直接添加一个登录窗体
这些都有了
目前是: form1 (主窗体),form2 (管理员窗体),在form1上面有两个text(分别是text1和text2) text1 用来输入name, text2 用来输入password.
当密码和用户名正确后,打开form1.
小弟不是很想用VB自带的窗体啊....
想自己写.但是又看的不是很懂....
什么意思?
If Text1.Text = "user" and Text2.Text = "123" Then
if isok then
form3.show
unload me
else
msgbox "用户名或密码错误!"
end if
end subPrivate Function isok() As boolean
On Error GoTo Errs
Dim Sql As String
Dim sPass As String, sName As String
sPass=txtPass.Text
sName=txtName.text
Sql = "select zlUser_Pass from zlUser where zlUser_Name='" & sName & "'"
adoRs.Open Sql, adoCn, 1, 3
If adoRs.RecordCount = 1 Then
If sPass =iif(isnull(adoRs("zlUser_Pass")),"",adors("zluser_Pass")Then
isok=true
Else
isok=false
End If
Else
isok=false
End If
adoRs.Close
Exit Function
Errs:
MsgBox Err.Description
isok=false
End Function
If (Text1.Text = "user") and (Text2.Text = "123") Then
Form2.Show
Else
Call MsgBox("Name or Password Error !", vbOKOnly + 48, "WARNING !")
End If
End Sub
Form2.Show