pexam5_5.frm

来自「深圳大学的vb上机与教学的课件」· FRM 代码 · 共 90 行

FRM
90
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1515
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4110
   LinkTopic       =   "Form1"
   ScaleHeight     =   1515
   ScaleWidth      =   4110
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1920
      MaxLength       =   6
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   360
      Width           =   1575
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1920
      TabIndex        =   2
      Top             =   960
      Width           =   195
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "请输入口令:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   1680
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Static I As Integer               ' 变量I统计输入错误口令的次数
If KeyCode = 13 Then              ' 如果按下的键为回车键
  If UCase(Text1.Text) = "HELLO" Then   ' 如果口令为"HELLO"
    Label2.Caption = "恭喜!,您已成功进入本系统"
  ElseIf I = 0 Or I = 1 Then      ' 如果口令错且错误次数少于2
    I = I + 1
    Label2.Caption = "口令错!,请重新输入"
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
  Else                             ' 如果口令错且错误次数等于2
    MsgBox "对不起,您不能使用本系统"
  End          ' 退出应用程序。
  End If
End If
End Sub

⌨️ 快捷键说明

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