按照升序排序数组数组
问题描述:
我有一个代码来显示一个非重复的随机数,但我坚持不按升序排序。按照升序排序数组数组
这里我的代码:
Public Class Form1
Dim intNumber As Integer
Dim arrNumber(0 To 5) As Integer
Dim i, x, y As Integer
Private Sub mostrar_resultados_sorteo(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
repetido()
For i = 0 To 5
ListBox1.Items.Add(arrNumber(i).ToString)
Next
End Sub
Private Sub repetido()
For x = 0 To 5
Start:
Randomize()
intNumber = Int((49 * Rnd()) + 1)
For y = 0 To 5
If intNumber = arrNumber(y) Then
GoTo Start
End If
Next y
arrNumber(x) = intNumber
Next x
ordenar()
End Sub
Private Sub ordenar()
End Sub
末级
您的ListBox1设置为对项目进行排序吗? –
列表框仅用于打印,数字必须出去并排序 – Cazs