⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f3-5.frm

📁 VB课程教学的讲义源的代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "统计字母"
   ClientHeight    =   2064
   ClientLeft      =   60
   ClientTop       =   348
   ClientWidth     =   5712
   LinkTopic       =   "Form1"
   ScaleHeight     =   2064
   ScaleWidth      =   5712
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture1 
      Height          =   615
      Left            =   240
      ScaleHeight     =   564
      ScaleWidth      =   5364
      TabIndex        =   2
      Top             =   840
      Width           =   5415
   End
   Begin VB.CommandButton Command1 
      Caption         =   "统计"
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   1560
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2040
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   120
      Width           =   3615
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "输入字符串"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   480
      TabIndex        =   3
      Top             =   240
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
 Dim a(1 To 26) As Integer, c As String * 1
 le = Len(Text1)                       '求字符串的长度
 For I = 1 To le
  c = UCase(Mid(Text1, I, 1))          '取一个字符,转换成大写
  If c >= "A" And c <= "Z" Then
      j = Asc(c) - 65 + 1               '将A~Z大写字母转换成1~26的下标
      a(j) = a(j) + 1                   '对应数组元素加1
  End If
  Next I
  For j = 1 To 26                       '输出字母及其出现的次数
     If a(j) > 0 Then Picture1.Print " "; Chr$(j + 64); "="; a(j);
  Next j
 End Sub

⌨️ 快捷键说明

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