Sub BubbleSort(LV As ListView)
Dim swapped As Boolean
Dim IndexArr(LV.size) As Int
Dim i As Int, temp As Int
swapped = True
For i = 0 To LV.size -1
IndexArr(i) = i
Next
Do While swapped
swapped = False
For i = 1 To LV.size - 1
If LV.GetItem(i - 1) > LV.GetItem(i) Then
temp = IndexArr(i - 1)
IndexArr(i-1) = IndexArr(i)
IndexArr(i) = temp
swapped = True
End If
Next
Loop
'Add the sorted values to the original ListView
LV.Clear
For i = 0 To LV.size -1
LV.AddTwoLinesWithBitmap2(firstLabels(IndexArr(i)), secondLabels(IndexArr(i)), _
LoadBitmap(File.DirAsstes, Icons(IndexArr(i))), secondLabels(IndexArr(i)))
Next
End Sub