📄 frmpsw.frm
字号:
VERSION 5.00
Object = "{AD03F86E-2FCA-4C6B-BAFD-3B3A9708EC72}#2.0#0"; "UserCtrProj.ocx"
Begin VB.Form frmPsw
BorderStyle = 1 'Fixed Single
Caption = "用户登录"
ClientHeight = 2505
ClientLeft = 45
ClientTop = 330
ClientWidth = 4110
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2505
ScaleWidth = 4110
StartUpPosition = 3 'Windows Default
Begin UserCtrProj.UsrPicBtn cmdCancel
Height = 525
Left = 2280
TabIndex = 3
Top = 1680
Width = 1335
_ExtentX = 2355
_ExtentY = 926
Picture = "frmPsw.frx":0000
Caption = " 取消"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin UserCtrProj.UsrPicBtn cmdOk
Height = 525
Left = 480
TabIndex = 2
Top = 1680
Width = 1335
_ExtentX = 2355
_ExtentY = 926
Picture = "frmPsw.frx":0100
Caption = " 确定"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin UserCtrProj.UsrCtrText txtPsw
Height = 375
Left = 1680
TabIndex = 1
Top = 960
Width = 1935
_ExtentX = 3413
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
PasswordChar = "*"
FontSize = 8.25
FontName = "MS Sans Serif"
End
Begin UserCtrProj.UsrCtrText txtUser
Height = 375
Left = 1680
TabIndex = 0
Top = 240
Width = 1935
_ExtentX = 3413
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontSize = 8.25
FontName = "MS Sans Serif"
End
Begin VB.Label lblPsw
Caption = "请输入密码:"
Height = 375
Left = 120
TabIndex = 5
Top = 960
Width = 1335
End
Begin VB.Label lblName
Caption = "请输入用户名:"
Height = 375
Left = 120
TabIndex = 4
Top = 240
Width = 1335
End
End
Attribute VB_Name = "frmPsw"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
'取消所有载入的窗体
Unload frmMainMDI
Unload frmFlash
Unload Me
End Sub
Private Sub cmdOk_Click()
Dim rsLoad As ADODB.Recordset
Dim strSql As String
dbUser = txtUser.Text
usrPsw = txtPsw.Text
'用来从数据库中获取记录集的字符串,SQL语句
strSql = "select * from uUsers where 用户名=" & "'" & dbUser & "'" & _
" and 用户密码=" & "'" & usrPsw & "'"
'显示快闪窗体
Load frmFlash
frmFlash.Show
DoEvents
'利用StarModule里定义的获取记录集的函数获取数据库中用户表的记录集
Set rsLoad = GetRecordSet(strSql)
'判断表是否不包含任何记录
If Not (rsLoad.EOF And rsLoad.BOF) Then
'执行这两条记录是为了数据库能正确的返回记录个数
rsLoad.MoveLast
rsLoad.MoveFirst
'其实,如果包含记录的话,就已经等于有该用户存在了
'此处的语句属于多余
If rsLoad.RecordCount > 0 Then
'取得用户权限,以备后面之用
strUsrLevel = Trim$(rsLoad("用户权限"))
'载入应用程序主窗体,激活系统登录的隐含检测步骤
Load frmMainMDI
frmMainMDI.Show
Unload frmFlash '关闭快闪窗体
Else
MsgBox "用户名或密码错误!"
Exit Sub
End If
Else
MsgBox "用户名或密码错误!"
Unload frmFlash '关闭快闪窗体
txtUser.SetFocus
txtUser.SelLength = Len(txtUser.Text)
Exit Sub
End If
rsLoad.Close
Set rsLoad = Nothing
Unload frmPsw
End Sub
Private Sub Form_Load()
Move (Screen.Width - Me.Width) / 2, _
(Screen.Height - Me.Height) / 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -