Public Class Form17
Dim num(5)
Dim num1(5)
Dim Rnd As Integer, randomNum As New Random()
Private Sub Form17_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
For i = 1 To 5
num(i) = randomNum.Next(1, 99)
ListBox1.Items.Add(num(i))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox2.Items.Clear()
Dim y As Integer
Dim i As Integer = 5
For y = 1 To 5
ListBox2.Items.Add(num(i))
i = i - 1
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x As Object = 111
Dim i As Object = 0
Dim y As Object = 0
Dim c As Object = 0
Dim z As Object = 0
For i = 1 To 5
For y = 1 To 5
If num(y) < x Then
x = num(y)
End If
Next
num1(i) = x
For c = 1 To 5
If num(c) = num1(i) Then
num(c) = 100
End If
Next
Next
For z = 1 To 5
ListBox3.Items.Add(num1(z))
Next
End Sub
End Class
ช่วยหน่อย อยากได้โค้ดให้มันเรียงข้อมูลจากน้อยไปหามาก ตรง Private Sub Button2_Click จะเขียนโค้ดไปยังไงดี