practice7_5.frm

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

FRM
76
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2730
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7200
   LinkTopic       =   "Form1"
   ScaleHeight     =   2730
   ScaleWidth      =   7200
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text2 
      Height          =   735
      Left            =   1560
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   3
      Top             =   1560
      Width           =   5175
   End
   Begin VB.TextBox Text1 
      Height          =   855
      Left            =   1560
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   2
      Top             =   360
      Width           =   5295
   End
   Begin VB.CommandButton Command2 
      Caption         =   "排序:"
      Height          =   495
      Left            =   240
      TabIndex        =   1
      Top             =   1680
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "生成数据:"
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   480
      Width           =   1215
   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()
   Randomize
   For i = 1 To 20
   A(i) = Int(Rnd * 50 + 1)
   Text1.Text = Text1.Text & Str(A(i)) & Space(3)
  Next i
End Sub

Private Sub Command2_Click()
 For i = 1 To 19
    For j = i + 1 To 20
      If A(i) < A(j) Then
        t = A(i)
        A(i) = A(j)
        A(j) = t
      End If
    Next j
  Next i
  Text2.Text = ""
  For i = 1 To 20
   Text2.Text = Text2.Text & Str(A(i)) & Space(3)
  Next i
End Sub

⌨️ 快捷键说明

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