📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form FrmLogin
BorderStyle = 1 'Fixed Single
Caption = "身份验证"
ClientHeight = 2160
ClientLeft = 45
ClientTop = 330
ClientWidth = 3990
ControlBox = 0 'False
Icon = "FrmLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2160
ScaleWidth = 3990
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
BackColor = &H80000000&
Height = 1215
Left = 240
TabIndex = 4
Top = 120
Width = 3495
Begin VB.TextBox txtUser
Height = 270
Left = 1080
MaxLength = 20
TabIndex = 0
ToolTipText = "输入用户名,不超过20个字符"
Top = 315
Width = 2175
End
Begin VB.TextBox txtPwd
Height = 270
IMEMode = 3 'DISABLE
Left = 1080
MaxLength = 20
PasswordChar = "*"
TabIndex = 1
ToolTipText = "输入密码,不超过20个字符"
Top = 795
Width = 2175
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 码"
Height = 180
Left = 240
TabIndex = 6
Top = 840
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名"
Height = 180
Left = 240
TabIndex = 5
Top = 360
Width = 540
End
End
Begin VB.CommandButton Cmd_Ok
BackColor = &H80000000&
Caption = "确 定"
Default = -1 'True
Height = 400
Left = 435
MouseIcon = "FrmLogin.frx":0442
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 1560
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
BackColor = &H80000000&
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 2235
MouseIcon = "FrmLogin.frx":074C
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 1560
Width = 1300
End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public PasswordKey As String
Public NameKey As String
Public Try_times As Integer
Private Sub Cmd_Cancel_Click()
End
End Sub
Private Sub Cmd_OK_Click()
Dim j As Single
'数据有效性检查
If txtUser = "" Then
MsgBox "请输入用户名"
txtUser.SetFocus
Exit Sub
End If
If txtPwd = "" Then
MsgBox "请输入密码"
txtPwd.SetFocus
Exit Sub
End If
NameKey = MakeStr(txtUser)
PasswordKey = MakeStr(txtPwd)
'判断用户是否存在
If MyUser.In_DB(NameKey) = False Then
MsgBox "用户名不存在"
Try_times = Try_times + 1
If Try_times >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭"
DBapi_Disconnect
End
Else
Exit Sub
End If
End If
'判断密码是否正确
MyUser.GetInfo (NameKey)
If MyUser.Pwd <> PasswordKey Then
MsgBox "密码错误"
Try_times = Try_times + 1
If Try_times >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭"
DBapi_Disconnect
End
Else
Exit Sub
End If
End If
'登录成功,将当前用户的信息保存在CurUser中
CurUser.GetInfo (MyUser.UserName)
'关闭自己
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -