📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 0
ClientTop = 0
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00FFFFFF&
Height = 1755
Left = 1050
TabIndex = 5
Top = 1080
Width = 3345
Begin VB.CommandButton cmdquit
Cancel = -1 'True
Caption = "退出[&Q]"
Height = 345
Left = 1230
TabIndex = 3
Top = 1230
Width = 915
End
Begin VB.TextBox txtpwd
Appearance = 0 'Flat
BeginProperty Font
Name = "Tahoma"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 1
Tag = "密码"
Top = 720
Width = 2115
End
Begin VB.TextBox txtname
Appearance = 0 'Flat
BeginProperty Font
Name = "Tahoma"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1080
TabIndex = 0
Tag = "用户名"
Top = 300
Width = 2115
End
Begin VB.CommandButton cmdno
Caption = "取消[&C]"
Height = 345
Left = 2220
TabIndex = 4
Top = 1230
Width = 915
End
Begin VB.CommandButton cmdenter
Caption = "进入[&E]"
Height = 345
Left = 240
TabIndex = 2
Top = 1230
Width = 915
End
Begin VB.Label txtplace
Alignment = 2 'Center
BackStyle = 0 'Transparent
BeginProperty Font
Name = "Tahoma"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1260
TabIndex = 8
Top = 1230
Width = 1935
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "密 码"
Height = 225
Index = 0
Left = 210
TabIndex = 7
Top = 780
Width = 585
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名"
Height = 255
Left = 210
TabIndex = 6
Top = 330
Width = 615
End
End
Begin VB.Image Bar
Height = 255
Left = 0
Picture = "frmlogin.frx":0000
Stretch = -1 'True
Top = 30
Width = 4185
End
Begin VB.Image Sysleft
Height = 480
Left = 4170
Picture = "frmlogin.frx":6876
Top = 0
Width = 480
End
Begin VB.Label lbltitle
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "考勤管理系统"
BeginProperty Font
Name = "Tahoma"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 210
TabIndex = 9
Top = 60
Width = 1350
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 Pwdtimes As Integer
Private Sub Bar_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If Button = 1 Then
ReleaseCapture
lngReturnValue = SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub
Private Sub cmdenter_Click()
If Trim(txtname) = "" Then
MsgBox "对不起,请输入用户名", vbInformation, App.Title
txtname.SetFocus
Exit Sub
End If
If InStr(1, txtname.Text, "'") <> 0 Or InStr(1, txtname.Text, "and") <> 0 Or InStr(1, txtname.Text, "or") <> 0 Then
MsgBox "用户名不合法!", vbInformation, App.Title
txtname.Text = ""
txtname.SetFocus
Exit Sub
End If
Dim Login_rs As New ADODB.Recordset
Login_rs.Open "select 用户名,口令,姓名 from users where 用户名='" & _
Trim(txtname.Text) & "'", CN, 1, 3
If Login_rs.EOF Then
MsgBox "用户名不存在!", vbInformation, App.Title
txtname.Text = ""
txtname.SetFocus
Exit Sub
End If
If LCase(txtpwd.Text) <> Login_rs(1) Then
MsgBox "用户密码错误!", vbInformation, App.Title
txtpwd.Text = ""
txtpwd.SetFocus
Pwdtimes = Pwdtimes + 1
If Pwdtimes >= 3 Then
MsgBox "密码输入错误超过3次!系统强制退出!", vbInformation, App.Title
End
End If
Exit Sub
End If
Loginname = Login_rs(2)
Set Login_rs = Nothing
Access = 1
Load frmmain
frmmain.Show
Unload Me
End Sub
Private Sub cmdno_Click()
txtname.Text = ""
txtpwd.Text = ""
txtname.SetFocus
End Sub
Private Sub cmdQuit_Click()
If MsgBox("确实要退出吗?", vbQuestion + vbYesNo + vbDefaultButton2, App.Title) = vbYes Then _
Unload Me
End Sub
Private Sub Sysleft_Click()
On Error Resume Next
If MsgBox("确实要退出吗?", vbQuestion + vbYesNo + vbDefaultButton2, App.Title) = vbYes Then _
Unload Me
End Sub
Private Sub txtname_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtpwd.SetFocus
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 + -