📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
BorderStyle = 1 'Fixed Single
Caption = "身份验证"
ClientHeight = 2130
ClientLeft = 45
ClientTop = 330
ClientWidth = 4020
ControlBox = 0 'False
Icon = "frmlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MouseIcon = "frmlogin.frx":030A
ScaleHeight = 2130
ScaleWidth = 4020
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 400
Left = 2115
MouseIcon = "frmlogin.frx":0614
MousePointer = 99 'Custom
TabIndex = 6
Top = 1560
Width = 1300
End
Begin VB.CommandButton cmd_ok
Caption = "确定"
Height = 400
Left = 432
MouseIcon = "frmlogin.frx":091E
MousePointer = 99 'Custom
TabIndex = 5
Top = 1560
Width = 1300
End
Begin VB.Frame Frame1
Height = 1215
Left = 240
TabIndex = 2
Top = 120
Width = 3495
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.TextBox txtuser
Height = 270
Left = 1080
MaxLength = 20
TabIndex = 0
ToolTipText = "输入用户名,不超过20个字符"
Top = 315
Width = 2175
End
Begin VB.Label Label2
Caption = "密 码"
Height = 180
Left = 240
TabIndex = 4
Top = 840
Width = 540
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 240
TabIndex = 3
Top = 360
Width = 540
End
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 "您已经3次尝试进入本系统,均不成功,系统将关闭"
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 "您已经3次尝试进入本系统,均不成功,系统将关闭"
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 + -