practice7_3.frm

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

FRM
79
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2025
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2025
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1680
      TabIndex        =   3
      Top             =   1080
      Width           =   2775
   End
   Begin VB.CommandButton Command2 
      Caption         =   "求最大数"
      Height          =   495
      Left            =   120
      TabIndex        =   2
      Top             =   1080
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "生成随机整数"
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   240
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      Height          =   735
      Left            =   1680
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   0
      Top             =   120
      Width           =   2775
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(1 To 20) As Integer
Private Sub Command1_Click()
  Text1.Text = ""
  Randomize
  For i = 1 To 20
    a(i) = Int(Rnd * 101)
    Text1.Text = Text1.Text & Str(a(i)) & " "
  Next i
End Sub

Private Sub Command2_Click()
  Max = a(1)
  For i = 2 To 20
    If a(i) > Max Then
      Max = a(i)
    End If
  Next i
  Text2.Text = "   " & "最大数=" & Str(Max)
End Sub

⌨️ 快捷键说明

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