例[11-1].frm

来自「蒋加伏主编VB程序设计第四版PPT及全部课本源码 北京邮电大学出版社 」· FRM 代码 · 共 39 行

FRM
39
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "例[11-1] KeyPress事件"
   ClientHeight    =   2070
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3645
   LinkTopic       =   "Form1"
   ScaleHeight     =   2070
   ScaleWidth      =   3645
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   3375
   End
   Begin VB.Label Label1 
      BorderStyle     =   1  'Fixed Single
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   1080
      Width           =   3375
   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_KeyPress(KeyAscii As Integer)
 Dim char As String
 char = UCase(Chr(KeyAscii))               '将小写转换成大写
 Label1.Caption = Label1.Caption & char    '新输入的字符与已输入的字符连接
End Sub

⌨️ 快捷键说明

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