📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "密码-小凡工作室"
ClientHeight = 3195
ClientLeft = 5610
ClientTop = 4170
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Form2.frx":0000
ScaleHeight = 3195
ScaleWidth = 4680
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 300
Left = 480
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "KeyID"
Top = 1800
Visible = 0 'False
Width = 1695
End
Begin VB.CommandButton cmdquit
Caption = "退出"
Height = 495
Left = 2520
TabIndex = 5
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 495
Left = 480
TabIndex = 4
Top = 2280
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 3
Top = 1080
Width = 1935
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 2
Top = 360
Width = 1935
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码:"
BeginProperty Font
Name = "黑体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 1
Top = 1080
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "黑体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 0
Top = 480
Width = 1215
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const MAX_LOGON_ATTEMPTS As Integer = 3
Private Sub Command1_Click()
End Sub
Private Sub cmdok_Click()
Data1.Recordset.FindFirst "UserName='" & Text1.Text & "'"
If Data1.Recordset.NoMatch Then
MsgBox "没有该用户,请重新输入用户名!", vbOKOnly, "提示框"
Text1.Text = ""
Text1.SetFocus
ElseIf Data1.Recordset!Key = Text2.Text Then
Data1.Recordset.Edit
Data1.Recordset.Fields("State") = 1
Data1.Recordset.Update
进入界面.Show
Unload Me
Else
msg = MsgBox("密码错误")
Text2.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub cmdok_KeyPress(KeyAscii As Integer)
Data1.Recordset.FindFirst "UserName='" & Text1.Text & "'"
If Data1.Recordset!Key = Text2.Text Then
Data1.Recordset.Edit
Data1.Recordset.Fields("State") = 1
Data1.Recordset.Update
进入界面.Show
Form2.Hide
Else
msg = MsgBox("用户名或密码错误")
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub cmdquit_Click()
Unload Me
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path + "\" + "jjdd.mdb"
Data1.Refresh
Data1.Recordset.FindFirst "State=1"
If Data1.Recordset.NoMatch Then
Else
Data1.Recordset.Edit
Data1.Recordset.Fields("State") = 0
Data1.Recordset.Update
End If
End Sub
Private Sub Option1_Click()
cmdok.Enabled = True
Label1.Enabled = False
Label2.Enabled = False
Text1.Enabled = False
Text2.Enabled = False
End Sub
Private Sub Option2_Click()
cmdok.Enabled = False
Label1.Enabled = True
Label2.Enabled = True
Text1.Enabled = True
Text2.Enabled = True
Text1.SetFocus
End Sub
Private Sub Text1_Change()
If Text1.Text <> "" And Text2.Text <> "" Then
cmdok.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text1.Text = "" Then
MsgBox "请输入用户名!", vbOKOnly, "提示框"
Text1.Text = ""
Text1.SetFocus
Else
Text2.SetFocus
End If
End If
End Sub
Private Sub Text2_Change()
If Text1.Text <> "" And Text2.Text <> "" Then
cmdok.Enabled = True
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text2.Text = "" Then
MsgBox "请输入密码!", vbOKOnly, "提示框"
Else
cmdok.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -