frmarra2.frm

来自「Visual Basic 6 大学教程的代码」· FRM 代码 · 共 90 行

FRM
90
字号
VERSION 5.00
Begin VB.Form frmArrayEven 
   Caption         =   "Fig. 7.3: Placing values into array elements"
   ClientHeight    =   3030
   ClientLeft      =   2325
   ClientTop       =   2010
   ClientWidth     =   5100
   BeginProperty Font 
      Name            =   "Courier"
      Size            =   12
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000008&
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   3030
   ScaleWidth      =   5100
   Begin VB.CommandButton cmdExit 
      BackColor       =   &H80000005&
      Caption         =   "Exit"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   3540
      TabIndex        =   1
      Top             =   1140
      Width           =   1335
   End
   Begin VB.CommandButton cmdPrint 
      BackColor       =   &H80000005&
      Caption         =   "Print"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   3540
      TabIndex        =   0
      Top             =   180
      Width           =   1335
   End
End
Attribute VB_Name = "frmArrayEven"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 7.3
' Initializing an array
Option Explicit

Private Sub cmdPrint_Click()
   Dim s(9) As Integer
   Dim x As Integer

   Call Cls

   ' Initialize array to even elements
   For x = LBound(s) To UBound(s)
      s(x) = 2 + 2 * x
   Next x

   Print "Index" & Space$(3) & "Value"

   For x = LBound(s) To UBound(s)
      Print Space$(2) & x & Space$(7) & s(x)
   Next x
   
End Sub

Private Sub cmdExit_Click()
   End
End Sub

⌨️ 快捷键说明

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