📄 frmsyslogon.frm
字号:
VERSION 5.00
Begin VB.Form SystemLogon
BorderStyle = 3 'Fixed Dialog
Caption = "图书管理系统用户登录"
ClientHeight = 2550
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
ControlBox = 0 'False
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2550
ScaleWidth = 4680
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 2640
TabIndex = 5
Top = 1800
Width = 1095
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 375
Left = 1200
TabIndex = 4
Top = 1800
Width = 975
End
Begin VB.TextBox txtLog
Height = 375
IMEMode = 3 'DISABLE
Index = 1
Left = 1320
MaxLength = 6
PasswordChar = "*"
TabIndex = 1
Top = 1080
Width = 2535
End
Begin VB.TextBox txtLog
Height = 375
Index = 0
Left = 1320
MaxLength = 5
TabIndex = 0
Top = 480
Width = 2535
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "口令 "
Height = 180
Left = 840
TabIndex = 3
Top = 1200
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "编号"
Height = 180
Left = 840
TabIndex = 2
Top = 600
Width = 360
End
End
Attribute VB_Name = "SystemLogon"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const MaxLogTimes As Integer = 3 '定义允许用户验证登录信息的最大次数
Private Sub cmdCancel_Click()
'请求用户确认是否真的退出系统登录
If MsgBox("你选择了退出系统登录,退出将不能启动管理系统!" & vbCrLf _
& "是否真的退出?", vbYesNo, "登录验证") = vbYes Then
Unload Me '卸载登录窗体
End If
End Sub
Private Sub cmdOk_Click()
'静态常量intLogTimes用于保存用户请求验证的次数
Static intLogTimes As Integer
intLogTimes = intLogTimes + 1 '保存登录次数
If intLogTimes > MaxLogTimes Then
'超过允许的登录次数,显示提示信息
MsgBox "你已经超过允许的登录验证次数!" & vbCr _
& "应用程序将结束!", vbCritical, "登录验证"
End '结束应用程序
Else
With Library_Manage.rsSysUsers '检验用户编号和口令的合法性
.Open
If .RecordCount > 0 Then
.MoveFirst
.Find "编号='" & Trim(txtLog(0)) & "'"
If .EOF Then
MsgBox Trim(txtLog(0)) & "不是系统用户,请检查输入!", _
vbCritical, "登录验证"
txtLog(0).SetFocus
txtLog(0).SelStart = 0
txtLog(0).SelLength = Len(txtLog(0))
ElseIf .Fields("口令") <> Trim(txtLog(1)) Then
MsgBox "口令错误,请重新输入口令!", vbCritical, "登录验证"
txtLog(1).SetFocus
txtLog(1) = ""
Else
CurrentUserNum = .Fields("编号")
CurrentUserPassword = .Fields("口令")
CurrentUserStatus = .Fields("权限")
MsgBox "欢迎使用北京交通大学管理系统!", vbInformation, "登录成功"
Unload Me
SystemMain.Show '显示系统主窗体
End If
End If
.Close '关闭记录集
End With
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -