📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Login"
ClientHeight = 1710
ClientLeft = 60
ClientTop = 375
ClientWidth = 3480
LinkTopic = "Form1"
ScaleHeight = 1710
ScaleWidth = 3480
StartUpPosition = 3 '窗口缺省
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 405
Left = 120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 1710
Width = 3585
End
Begin VB.CommandButton Command2
Caption = "Login"
Height = 435
Left = 1920
TabIndex = 5
Top = 1110
Width = 1425
End
Begin VB.CommandButton Command1
Caption = "Login(Simple)"
Height = 435
Left = 60
TabIndex = 4
Top = 1080
Width = 1575
End
Begin VB.TextBox Text2
Height = 405
Left = 1230
TabIndex = 1
Text = "Text2"
Top = 600
Width = 2175
End
Begin VB.TextBox Text1
Height = 405
Left = 1230
TabIndex = 0
Text = "Text1"
Top = 90
Width = 2175
End
Begin VB.Label Label2
Caption = "Password:"
Height = 405
Left = 90
TabIndex = 3
Top = 600
Width = 1005
End
Begin VB.Label Label1
Caption = "UserName:"
Height = 405
Left = 90
TabIndex = 2
Top = 90
Width = 1005
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "Top" And Text2.Text = "Pass" Then
Form2.Show
Else
MsgBox "密码或用户名错误"
End If
End Sub
Private Sub Command2_Click()
Dim dbs As Database
Dim rst As Recordset
Set dbs = OpenDatabase(App.Path & "\users.mdb")
Set rst = dbs.OpenRecordset("Users")
rst.MoveFirst
Do While Not rst.EOF
If Text1.Text = rst.Fields("用户名") And Text2.Text = rst.Fields("密码") Then
Form2.Show
Exit Sub
Me.Hide
dbs.Close
Else
rst.MoveNext
End If
Loop
MsgBox "用户名或密码错误"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -