📄 form_login.frm
字号:
VERSION 5.00
Begin VB.Form form_login
BackColor = &H00C0FFFF&
BorderStyle = 1 'Fixed Single
Caption = "仓库扫描管理系统"
ClientHeight = 2445
ClientLeft = 3240
ClientTop = 4230
ClientWidth = 4455
Icon = "form_login.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2445
ScaleWidth = 4455
StartUpPosition = 1 'CenterOwner
Begin VB.TextBox txtCounter
Height = 285
Left = 3600
TabIndex = 7
Top = 2040
Visible = 0 'False
Width = 375
End
Begin VB.TextBox txtUser
Height = 315
Left = 1830
TabIndex = 0
Top = 240
Width = 1920
End
Begin VB.TextBox txtPassword
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
IMEMode = 3 'DISABLE
Left = 1830
MaxLength = 6
PasswordChar = "*"
TabIndex = 1
Top = 720
Width = 1920
End
Begin VB.CommandButton cmdExit
BackColor = &H00C0C0C0&
Height = 400
Left = 2355
Picture = "form_login.frx":000C
Style = 1 'Graphical
TabIndex = 3
Top = 1245
Width = 1020
End
Begin VB.CommandButton cmdConfirm
BackColor = &H00C0C0C0&
Height = 400
Left = 735
MaskColor = &H00FF8080&
Picture = "form_login.frx":19C6
Style = 1 'Graphical
TabIndex = 2
Top = 1245
UseMaskColor = -1 'True
Width = 1020
End
Begin VB.Line Line1
X1 = 105
X2 = 4185
Y1 = 1875
Y2 = 1875
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "版权所有:CopyRight 2005-2010"
Height = 225
Left = 795
TabIndex = 6
Top = 1965
Width = 2805
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户编号: "
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 720
TabIndex = 5
Top = 255
Width = 1095
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码: "
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 720
TabIndex = 4
Top = 735
Width = 1095
End
End
Attribute VB_Name = "form_login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim TIM As Integer '定义一个整型变量
Dim MESSAGE As String '定义一个字符串变量
Dim rsUser As Recordset
Private Sub cmdExit_Click()
End
End Sub
Private Sub Form_Activate()
'当记录为零时,进入系统具有所有权限
Set rsUser = g_db.OpenRecordset("hp_users")
If rsUser.RecordCount = 0 Then
MsgBox ("系统没有建立用户,请与系统管理员联系!")
Load frm_main
frm_main.Show
Unload Me
Else
txtUser.SetFocus 'txtUser获得焦点
End If
End Sub
Private Sub Form_Load()
TIM = 0 '为变量设初值
End Sub
Private Sub txtUser_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then txtPassword.SetFocus '按回车键txtPassword获得焦点
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
cmdConfirm.Visible = True
cmdConfirm.SetFocus
End If
If KeyCode = vbKeyUp Then txtUser.SetFocus '按向上键txtUser获得焦点
End Sub
Private Sub cmdConfirm_Click()
' txtCounter.Text = TIM '赋值给txtCounter.text
If txtUser.Text = "" Then '操作员代号为空,提示信息
MsgBox "请输入用户编号!", vbCritical, "警告"
txtUser.SetFocus
Exit Sub
End If
'查询操作员信息
Set rsUser = g_db.OpenRecordset("select * from hp_users where usercode='" & txtUser.Text & "'")
If rsUser.RecordCount = 1 Then
Dim strPwd As String
If IsNull(rsUser.Fields("password")) Then
strPwd = ""
Else
strPwd = rsUser.Fields("password")
End If
If txtPassword.Text <> strPwd Then
MsgBox "密码错误,请重新输入!", vbCritical, "警告"
txtPassword.SetFocus
rsUser.Close
Set rsUser = Nothing
Exit Sub
End If
Else
MsgBox "无此用户编号,请重新输入!", vbCritical, "警告"
txtUser.SetFocus
rsUser.Close
Set rsUser = Nothing
Exit Sub
End If
If validRegister = False Then
MsgBox "试用已经到期,请注册!"
rsUser.Close
Set rsUser = Nothing
Load form_Register
form_Register.Show
Unload Me
Else
g_userCode = rsUser.Fields("usercode")
g_userName = rsUser.Fields("username")
g_userGroup = rsUser.Fields("userGroup")
Load frm_main
frm_main.Show
Unload Me
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -