📄 form9.frm
字号:
VERSION 5.00
Begin VB.Form Form9
BackColor = &H00E0E0E0&
Caption = "请登陆"
ClientHeight = 2565
ClientLeft = 4590
ClientTop = 4350
ClientWidth = 5655
LinkTopic = "Form9"
ScaleHeight = 2565
ScaleWidth = 5655
Begin VB.CommandButton Command1
Caption = "退出"
Height = 375
Left = 3960
TabIndex = 6
Top = 1560
Width = 855
End
Begin VB.TextBox txtUsername
Height = 375
Left = 1560
TabIndex = 5
Top = 720
Width = 1695
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 3960
TabIndex = 3
Top = 1080
Width = 855
End
Begin VB.TextBox txtPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 1
Top = 1440
Width = 1695
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 375
Left = 3960
TabIndex = 0
Top = 600
Width = 855
End
Begin VB.Label Label2
Caption = "管理员名(&U):"
Height = 255
Left = 240
TabIndex = 4
Top = 720
Width = 1215
End
Begin VB.Label Label1
Caption = "密码(M):"
Height = 255
Left = 240
TabIndex = 2
Top = 1560
Width = 855
End
End
Attribute VB_Name = "Form9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const username As String = "123"
Const password As String = "123"
Private Sub cmdCancel_Click()
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
End Sub
Private Sub cmdOK_Click()
Dim i As Integer
Static n As Integer
If txtUsername.Text = username And txtPassword.Text = password Then
Form2.Show
Unload Form1
Unload Me
Else
n = n + 1
If n < 3 Then
i = MsgBox("用户名或密码错误,请重新输入!", vbCritical + vbRetryCancel + vbDefaultButton1, "登录失败")
If i = vbRetry Then
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
Else
End
End If
Else
MsgBox "三次错误,请退出!", vbOKOnly + vbExclamation, "登录失败"
End
End If
End If
End Sub
Private Sub Command1_Click()
Unload Me
Form1.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -