📄 frmsyslogon.frm
字号:
VERSION 5.00
Begin VB.Form SystemLogon
BorderStyle = 3 'Fixed Dialog
Caption = "用户登录"
ClientHeight = 1965
ClientLeft = 45
ClientTop = 330
ClientWidth = 4050
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 1965
ScaleWidth = 4050
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtLog
Height = 270
Index = 0
Left = 1320
TabIndex = 0
Top = 345
Width = 1815
End
Begin VB.TextBox txtLog
Height = 270
IMEMode = 3 'DISABLE
Index = 1
Left = 1305
PasswordChar = "*"
TabIndex = 1
Top = 855
Width = 1815
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 300
Left = 2265
TabIndex = 3
Top = 1305
Width = 735
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Default = -1 'True
Height = 300
Left = 1230
TabIndex = 2
Top = 1305
Width = 735
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "口令"
Height = 180
Left = 885
TabIndex = 5
Top = 885
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "编号"
Height = 180
Left = 885
TabIndex = 4
Top = 375
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
Drug_Store.rsSysUsers.Open '打开纪录集
With Drug_Store.rsSysUsers '检验用户名和口令的合法性
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
CurrentUserNumber = .Fields("编号")
CurrentUserPassword = .Fields("口令")
CurrentUserStatus = .Fields("权限")
MsgBox "欢迎使用仓储药房管理系统!", vbInformation, "登录成功"
Unload Me
SystemMain.Show
End If
End If
End With
Drug_Store.rsSysUsers.Close '关闭纪录集
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -