4.25.frm
来自「VB6.0应用例题」· FRM 代码 · 共 55 行
FRM
55 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1860
ClientLeft = 60
ClientTop = 345
ClientWidth = 4320
LinkTopic = "Form1"
ScaleHeight = 1860
ScaleWidth = 4320
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "排序"
Height = 495
Left = 2520
TabIndex = 0
Top = 960
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 Data(5 To 14) As Integer '定5-14为有效的下标范围
Dim I%
For I = 5 To 14
Data(I) = 30 - I
Next I
For I = 5 To 14
Print Data(I);
Next I
Print
Call Sort(Data())
For I = 5 To 14
Print Data(I);
Next I
Print T
End Sub
Private Sub Sort(Element() As Integer)
Dim I%, J%, T%
For I = LBound(Element, 1) To UBound(Element, 1) - 1
For J = I + 1 To UBound(Element, 1)
If Element(I) > Element(J) Then
T = Element(I)
Element(I) = Element(J)
Element(J) = T
End If
Next J
Next I
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?