practice7_4.frm

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

FRM
99
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6840
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   6840
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text3 
      Height          =   735
      Left            =   1320
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   3
      Top             =   2160
      Width           =   5295
   End
   Begin VB.CommandButton Command1 
      Caption         =   "删除"
      Height          =   495
      Left            =   240
      TabIndex        =   2
      Top             =   2280
      Width           =   975
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   1320
      TabIndex        =   1
      Top             =   1320
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      Height          =   735
      Left            =   1320
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   0
      Top             =   240
      Width           =   5175
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "随机数:"
      Height          =   180
      Left            =   480
      TabIndex        =   5
      Top             =   480
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "删除数:"
      Height          =   180
      Left            =   360
      TabIndex        =   4
      Top             =   1440
      Width           =   720
   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 100) As Integer
Private Sub Command1_Click()
  b = Val(Text2.Text)
  c = 0
  For i = 1 To 100
    If A(i) = b Then
       c = i
       Exit For
    End If
  Next i
  If c = 0 Then
    MsgBox ("此数不在数组中"): Exit Sub
  End If
  For p = c To 99
    A(p) = A(p + 1)
  Next p
  For i = 1 To 99
    Text3.Text = Text3.Text & Str(A(i)) & Space(4)
  Next i
End Sub

Private Sub Form_Load()
Randomize
For i = 1 To 100
  A(i) = Int(Rnd * 201 + (-100))
  Text1.Text = Text1.Text & Str(A(i)) & Space(3)
Next i
End Sub


⌨️ 快捷键说明

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