📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 2385
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 4920
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1409.137
ScaleMode = 0 'User
ScaleWidth = 4619.614
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtUserName
Height = 270
Left = 2880
TabIndex = 3
Text = "哈哈"
Top = 585
Width = 1755
End
Begin VB.TextBox txtPassword
Height = 270
IMEMode = 3 'DISABLE
Left = 2880
PasswordChar = "*"
TabIndex = 2
Text = "123"
Top = 990
Width = 1755
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 375
Left = 2700
TabIndex = 0
Tag = "确定"
Top = 1485
Width = 900
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 3780
TabIndex = 1
Tag = "取消"
Top = 1485
Width = 900
End
Begin VB.Label lblLabels
Caption = "用户名(&U):"
Height = 255
Index = 0
Left = 1755
TabIndex = 5
Tag = "用户名(&U):"
Top = 585
Width = 1080
End
Begin VB.Label lblLabels
Caption = "密码(&P):"
Height = 255
Index = 1
Left = 1755
TabIndex = 4
Tag = "密码(&P):"
Top = 1005
Width = 1080
End
Begin VB.Image Image1
Height = 2415
Left = -45
Picture = "frmLogin.frx":0000
Stretch = -1 'True
Top = -45
Width = 1515
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OK As Boolean
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'创建测试密码是否正确
'检查正确密码
Dim spassward As String
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & App.Path & "\db1.mdb;"
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select 用户,密码,权限 from 系统登录 ", db, adOpenStatic, adLockOptimistic
adoPrimaryRS.MoveFirst
Do Until adoPrimaryRS.EOF
sBuffer = adoPrimaryRS!用户
spassward = adoPrimaryRS!密码
accessflag = adoPrimaryRS!权限
If txtUserName.Text = sBuffer And txtPassword.Text = Trim(spassward) Then
OK = True
Exit Do
End If
adoPrimaryRS.MoveNext
Loop
'密码不正确
If adoPrimaryRS.EOF = True Then
MsgBox "密码错误,再试一次!", , "登录"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
Else
Me.Hide
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -