Private Sub bttSort_Click(sender As Object, e As EventArgs) Handles bttSort.Click
DataView1.Rows.Clear()
Dim i As Integer
Dim j As Integer
Dim temp As Integer
For i = 0 To list1.Length - 1
For j = (i + 1) To list1.Length - 1
If list1(i) > list1(j) Then
temp = list1(i)
list1(i) = list1(j)
list1(j) = temp
End If
Next
Next
DataView1.Rows.Clear()
For m As Integer = 0 To list1.Length - 1
DataView1.Rows.Add(list1(m))
Next
End Sub
I entered a string(1,3,5,6,7,113,23,62) After running the code above, the output should be sorted as (1, 3, 5, 6, 7, 23, 62, 113). But my out put was (1, 113, 23, 3, 5, 6, 62, 7). I have no idea, hope someone can help me. Thank you.