📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 1 'Fixed Single
ClientHeight = 2685
ClientLeft = 3495
ClientTop = 3060
ClientWidth = 4935
ControlBox = 0 'False
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2685
ScaleWidth = 4935
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 2565
Left = 60
ScaleHeight = 2535
ScaleWidth = 4785
TabIndex = 1
Top = 60
Width = 4815
Begin VB.CheckBox chk
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "登陆后查看库存报警"
ForeColor = &H80000008&
Height = 210
Left = 2580
TabIndex = 7
Top = 2280
Width = 1995
End
Begin VB.ComboBox cobUser
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 2100
Style = 2 'Dropdown List
TabIndex = 0
Top = 480
Width = 2205
End
Begin VB.TextBox txtPWD
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
IMEMode = 3 'DISABLE
Left = 2100
PasswordChar = "*"
TabIndex = 2
Top = 1020
Width = 2205
End
Begin Manage.xpcmdbutton cmdCancel
Cancel = -1 'True
Height = 405
Left = 2940
TabIndex = 3
Top = 1710
Width = 1335
_ExtentX = 2355
_ExtentY = 714
Caption = "取 消"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Manage.xpcmdbutton cmdEnter
Height = 405
Left = 990
TabIndex = 4
Top = 1710
Width = 1275
_ExtentX = 2249
_ExtentY = 714
Caption = "确 定"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Image Image1
Height = 600
Left = 60
Picture = "frmLogin.frx":000C
Stretch = -1 'True
Top = 90
Width = 585
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 1200
TabIndex = 6
Top = 1050
Width = 630
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用 户"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 1170
TabIndex = 5
Top = 540
Width = 630
End
Begin VB.Line Line1
BorderColor = &H00808080&
BorderWidth = 2
X1 = 210
X2 = 4560
Y1 = 1530
Y2 = 1530
End
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim LoopIn As Integer
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdEnter_Click()
If cobUser.ListIndex = -1 Then Exit Sub
Dim Rst As ADODB.Recordset
Dim SQL As String
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
SQL = "select purview from [user] where username='" & cobUser.Text & "' and password='" & txtPWD.Text & "'"
Rst.Open SQL, Conn, adOpenDynamic, adLockReadOnly, adCmdText
If Rst.EOF Then
Rst.Close
Set Rst = Nothing
LoopIn = LoopIn + 1
If LoopIn = 3 Then MsgBox "您已三次输入密码不正确,应用程序将退出!", 64: Unload Me: Exit Sub
MsgBox "您输入的密码不正确,不能登陆!", 64
txtPWD.SelStart = 0
txtPWD.SelLength = Len(txtPWD.Text)
txtPWD.SetFocus
Exit Sub
End If
If Rst.Fields(0) <> "系统管理员" Then MsgBox "您没有使用系统的权限,程序即将退出。", 64: Unload Me: Exit Sub
Rst.Close
Set Rst = Nothing
UserName = cobUser.Text
If chk.Value = 1 Then ViewStock = True
Unload Me
frmMain.Show
End Sub
Private Sub cobUser_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtPWD.SetFocus
End Sub
Private Sub Form_Load()
Dim Rst As ADODB.Recordset
Dim I As Integer
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
Rst.Open "select username from [user]", Conn, adOpenStatic, adLockReadOnly, adCmdText
If Rst.EOF Then Exit Sub
For I = 1 To Rst.RecordCount
cobUser.AddItem Rst.Fields(0)
Rst.MoveNext
Next
Rst.Close
Set Rst = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmLogin = Nothing
End Sub
Private Sub txtPWD_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then cmdEnter_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -