Hi, I'm a newbie vb6 user and am wondering why my bubble sorting is not working. Please check and see if what's wrong.

I have five text boxes with control array 0 to 4 and I can't get them to display in ascending order. The code below seem to have no effect or just duplicate some numbers.


Code:
Private Sub Command2_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim temp As Integer

flag = 1
Do While flag = 1 And i < 3
flag = 0
i = i + 1

For j = 1 To 4 - i
If txtResult(j + 1) < txtResult(j) Then
temp = txtResult(j)
txtResult(j) = txtResult(j + 1)
txtResult(j + 1) = temp
flag = 1
End If
Next j

Loop

End Sub
Thanks