为什么到第五个数字没有换行?
Dim a(10) As LongPrivate Sub Command1_Click()
Dim i As Long, b As Long, j As Long
For i = 1 To 10
For j = 1 To 10 - i
If a(j) > a(j + 1) Then
b = a(j)
a(j) = a(j + 1)
a(j + 1) = b
End If
Next j
Next i
For i = 1 To 10
Text1.Text = Text1.Text + CStr(a(i)) + " "
If i = 5 Then Text1.Text = Text1.Text + Chr(13) + Chr(10)
Next i
End Sub
Private Sub command2_click()
Dim i As Long, l
Text1.Text = ""
For i = 1 To 10
N: l = InputBox("请输入10个数,这是第" & CStr(i) & "个", "提示", "")
If IsNumeric(l) Then
a(i) = l
Else
MsgBox "请输入数字", vbOKOnly, "错误"
GoTo N
End If
Next i
End Sub