📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{FAEEE763-117E-101B-8933-08002B2F4F5A}#1.1#0"; "DBLIST32.OCX"
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 2460
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 4950
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1453.449
ScaleMode = 0 'User
ScaleWidth = 4647.782
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtpas
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
IMEMode = 3 'DISABLE
Left = 1275
MaxLength = 20
PasswordChar = "*"
TabIndex = 1
Top = 750
Width = 2325
End
Begin MSDBCtls.DBCombo DBCombolog
Bindings = "frmLogin.frx":0442
DataField = "用户"
DataSource = "Datalog"
Height = 390
Left = 1275
TabIndex = 0
Top = 150
Width = 2325
_ExtentX = 4101
_ExtentY = 688
_Version = 393216
Locked = -1 'True
ListField = "用户"
Text = ""
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Data Datalog
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\wwj\wj\ok\data.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 225
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "杂项"
Top = 2175
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 390
Left = 1080
TabIndex = 2
Top = 1530
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 390
Left = 2775
TabIndex = 3
Top = 1530
Width = 1140
End
Begin VB.Label lblLabels
Caption = "用户名称(&U):"
Height = 270
Index = 0
Left = 105
TabIndex = 4
Top = 150
Width = 1080
End
Begin VB.Label lblLabels
Caption = "密码(&P):"
Height = 270
Index = 1
Left = 75
TabIndex = 5
Top = 825
Width = 1080
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
Public password As Variant
Public user As String
Private Sub cmdCancel_Click()
'设置全局变量为 false
'不提示失败的登录
ok = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = OpenDatabase(App.Path & "\data.mdb")
Set rs = db.OpenRecordset("杂项")
Set Datalog.Recordset = rs
user = DBCombolog.Text
If txtpas = password Then
'将代码放在这里传递
'成功到 calling 函数
'设置全局变量时最容易的
' Main.Show
ok = True
Unload Me
system.Hide
frmSplash.Show
frmSplash.Refresh
Load main1
Unload frmSplash
main1.Show
Else
ok = False
MsgBox "无效的密码,请重试!", , "登录"
txtpas.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
Private Sub DBCombolog_Click(Area As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = OpenDatabase(App.Path & "\data.mdb")
user = DBCombolog.Text
Set rs = db.OpenRecordset("杂项") '("select * from 杂项 where 用户='" & DBCombolog.Text & "'")
Set Datalog.Recordset = rs
password = Datalog.Recordset.Fields("密码")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -