📄 frmenter.frm
字号:
VERSION 5.00
Begin VB.Form FrmEnter
BorderStyle = 1 'Fixed Single
Caption = "图书管理系统"
ClientHeight = 3285
ClientLeft = 45
ClientTop = 330
ClientWidth = 4815
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3285
ScaleWidth = 4815
StartUpPosition = 3 'Windows Default
Begin VB.Data DataEnter
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 2400
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = -240
Visible = 0 'False
Width = 1455
End
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 375
Left = 2520
TabIndex = 3
Top = 2400
Width = 975
End
Begin VB.CommandButton CmdEnter
Caption = "登入"
Height = 375
Left = 1200
TabIndex = 2
Top = 2400
Width = 975
End
Begin VB.TextBox TxtPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 1
Top = 1440
Width = 1815
End
Begin VB.TextBox TxtUser
Height = 375
Left = 1560
TabIndex = 0
Top = 840
Width = 1815
End
Begin VB.Label Label2
Caption = "密码"
Height = 375
Left = 840
TabIndex = 5
Top = 1560
Width = 495
End
Begin VB.Label Label1
Caption = "用户名"
Height = 375
Left = 840
TabIndex = 4
Top = 960
Width = 615
End
End
Attribute VB_Name = "FrmEnter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'************************************************************************
'本窗本用于用户登陆,当三次密码不对就退出
'*************************************************************************
Option Explicit
Private rsUserTable As Recordset
Private intcount As Integer
Private Sub CmdEnter_Click()
If intcount >= 3 Then
MsgBox "非法用户!", vbOKOnly + vbExclamation, ""
Exit Sub
End
End If
If TxtUser.Text = "" Or TxtPassword.Text = "" Then
MsgBox "请输入用户名与密码!", vbOKOnly + vbInformation, ""
Exit Sub
End If
With rsUserTable
rsUserTable.FindFirst " username = '" & TxtUser & "'"
If .NoMatch Then
intcount = intcount + 1
MsgBox "用户名不存在!", vbOKOnly + vbInformation, ""
TxtUser.Text = ""
TxtUser.SetFocus
Exit Sub
End If
.FindFirst "password ='" & TxtPassword & "'"
If .NoMatch Then
intcount = intcount + 1
MsgBox "密码输入不正确!", vbOKOnly + vbInformation, ""
TxtPassword.Text = ""
TxtPassword.SetFocus
Exit Sub
End If
End With
username = TxtUser.Text
userPassword = TxtPassword.Text
Unload Me
Load MDILibrary
MDILibrary.Show
End Sub
Private Sub CmdRegister_Click()
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub Form_GotFocus()
TxtUser.SetFocus
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.ScaleWidth) * 1 / 2
Me.Top = (Screen.Height - Me.ScaleHeight) * 1 / 2
InitializeDataPath
DataEnter.DatabaseName = DataPath
DataEnter.RecordSource = "select * from usertable"
DataEnter.Refresh
Set rsUserTable = DataEnter.Recordset
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set rsUserTable = Nothing
DataEnter.DatabaseName = ""
End Sub
Private Sub TxtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If TxtPassword.Text <> "" Then
CmdEnter_Click
End If
End If
End Sub
Private Sub TxtUser_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If TxtUser.Text <> "" Then
TxtPassword.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -