📄 dialog.frm
字号:
VERSION 5.00
Begin VB.Form Dialog
BackColor = &H00FFC0C0&
Caption = "登录"
ClientHeight = 3570
ClientLeft = 60
ClientTop = 345
ClientWidth = 3990
ControlBox = 0 'False
Icon = "Dialog.frx":0000
LinkTopic = "Form3"
ScaleHeight = 3570
ScaleWidth = 3990
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdOK
BackColor = &H00FFC0C0&
Caption = "确定"
Default = -1 'True
Height = 390
Left = 600
Style = 1 'Graphical
TabIndex = 4
Top = 2040
Width = 1140
End
Begin VB.CommandButton cmdCancel
BackColor = &H00FFC0C0&
Cancel = -1 'True
Caption = "取消"
Height = 390
Left = 2400
MaskColor = &H00FFC0C0&
Style = 1 'Graphical
TabIndex = 3
Top = 2040
Width = 1140
End
Begin VB.TextBox Text1
Height = 390
Index = 0
Left = 1560
TabIndex = 0
Top = 600
Width = 1935
End
Begin VB.TextBox Text1
Height = 390
IMEMode = 3 'DISABLE
Index = 1
Left = 1560
PasswordChar = "*"
TabIndex = 1
Top = 1080
Width = 1935
End
Begin VB.TextBox Text1
Height = 390
Index = 2
Left = 1560
TabIndex = 2
Top = 1560
Width = 1935
End
Begin VB.Label Label3
BackColor = &H00FFC0C0&
Caption = "TEL:86313282 MB:13366195557 "
Height = 255
Left = 360
TabIndex = 10
Top = 3000
Width = 3375
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
Caption = " 开发人员邮箱:zhaoyucheng-2002@163.com "
Height = 255
Left = -240
TabIndex = 9
Top = 2640
Width = 4695
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFC0C0&
Caption = " 用 户 登 录"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 840
TabIndex = 8
Top = 120
Width = 2100
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户名称(&U):"
ForeColor = &H00000000&
Height = 270
Index = 0
Left = 225
TabIndex = 7
Top = 1110
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密码(&P):"
ForeColor = &H00000000&
Height = 270
Index = 1
Left = 225
TabIndex = 6
Top = 1500
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "序号:"
ForeColor = &H00000000&
Height = 270
Index = 2
Left = 240
TabIndex = 5
Top = 720
Width = 1080
End
End
Attribute VB_Name = "Dialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public LoginSucceeded As Boolean
Dim miCount As Integer
Private Sub cmdCancel_Click()
'设置全局变量为 false
'不提示失败的登录
LoginSucceeded = False
Me.Hide
End
End Sub
Private Sub cmdOK_Click()
'检查正确的密码
'On Error GoTo cmdOK
Dim sql As String
'打开用户表
sql = "SELECT 赵玉成.* FROM 赵玉成 ORDER BY 赵玉成.序号" '选取数据记录 FROM
Set rs4 = db.OpenRecordset(sql, dbOpenDynaset) '代表创建有SELECT命令字符串所要选取的数据记录成DYNASET数据记录形式,
' 创建的结果设置给Recordset变量rs1.SET 对象变量rs1=数据库变量db.openRecordset(来源,种类)
Dim i As Integer
If Text1(i) = rs4.Fields(i) Then
Form1.Show
Dialog.Hide
ElseIf Text1(0) = "1" And Text1(1) = "zyc" Then
Form1.Show
Dialog.Hide
ElseIf Text1(0) = "2" And Text1(1) = "zyz" Then
Form2.Show
Dialog.Hide
Else
MsgBox "无效的密码,请重试!", , "登录"
Text1(i).SetFocus
SendKeys "{Home}+{End}"
End If
miCount = miCount + 1 '输入错误密码三次自动退出系统
If miCount = 3 Then
MsgBox "你是非法用户!", vbYesNo, "错误警告"
End
End If
Exit Sub
'cmdOK:
' MsgBox Err.Description
End Sub
Private Sub Form_Load()
On Error GoTo loaderr
Set db = OpenDatabase(App.Path & "\db8.mdb", False, False) '数据库的位置需要在默认系统盘上
Exit Sub
Text1(0).SetFocus
Exit Sub
loaderr:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -