📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
Caption = "用户登陆"
ClientHeight = 3495
ClientLeft = 60
ClientTop = 345
ClientWidth = 4920
LinkTopic = "Form1"
ScaleHeight = 3495
ScaleWidth = 4920
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 495
Left = 2160
TabIndex = 6
Top = 2520
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确 定"
Height = 495
Left = 600
TabIndex = 5
Top = 2520
Width = 1335
End
Begin VB.Frame Frame1
Height = 1935
Left = 360
TabIndex = 0
Top = 120
Width = 3495
Begin VB.TextBox txtpwd
Height = 375
Left = 960
TabIndex = 4
Text = " "
Top = 1080
Width = 1935
End
Begin VB.TextBox txtuser
Height = 375
Left = 960
TabIndex = 3
Text = " "
Top = 480
Width = 1935
End
Begin VB.Label Label2
Caption = "密 码"
Height = 375
Left = 240
TabIndex = 2
Top = 1200
Width = 855
End
Begin VB.Label Label1
Caption = "用户名"
Height = 375
Left = 240
TabIndex = 1
Top = 600
Width = 975
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 Command1_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
Private Sub Command2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -