I can only help you with an example from my class. If you were using a bubble sort to alphabetize the names Pay, Bob, Willy, Fred, Dave it would look like this. This doesn't format right, but you get the idea.
<< Dim nom(1 to 5) As String
Private Sub cmdSort_Click()
..Dim passNum As Integer, i As Integer, temp As String
....For passNum = 1 to 4
.......For i = 1 to 5 - passNum
...........If nom(i) > nom(i + 1) Then
..............temp = nom(i)
..............nom(i) = nom(i + 1)
..............nom(i+1) = temp
...........End If
.......Next i
....Next passNum
..For i = 1 to 5
.....picNames.print nom(i),
..Next i
End Sub >>
The periods are just place holders so fusetalk formats correctly.
This is assuming you have an array with the names in it. Basically what happens is this
1)It compars the 1st and 2nd items, then if they are out of order it swaps them
2)It compares the 2nd and 3rd items, then if they are out of order it swaps them.
3)Keep repeating this for the rest of the pairs. The final comparison and swap are with the second-to-last and last elements.