passwd.frm

来自「VB精彩百例」· FRM 代码 · 共 45 行

FRM
45
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1530
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3045
   LinkTopic       =   "Form1"
   ScaleHeight     =   1530
   ScaleWidth      =   3045
   StartUpPosition =   3  'Windows Default
   Begin VB.Label Label1 
      Caption         =   "密码验证已经通过,欢迎您使用本系统!"
      Height          =   615
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   2055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Dim passwd As String
Dim i As Integer
passwd = InputBox("输入密码", "密码框")
i = 0
If passwd = "test" Then
MsgBox ("密码正确!")
Else
Do While passwd <> "test"
 If i > 1 Then
 MsgBox ("已经三次密码输入错误,程序将关闭")
 Exit Do
 End If
 passwd = InputBox("输入密码", "密码框")
 i = i + 1
Loop
Unload Form1
End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?