Array Sort in Ascending Order

vickp07

Member
Joined
Sep 8, 2009
Messages
7
Programming Experience
3-5
I am loading an array with data at form load from a text file. I then display that data in a label box. When a user clicks a button I want to sort the data in ascending order.

I have a sort code right nowbut it is not correct at all! !!!
Another problem i dont know if it will correctly sort becuase the data from the input file is like this:

C2 CA D4 S9 HA C4 CQ D3 DA DQ .....AND SO ON AND SO on up to 52 like a card deck, please help

here is my code:
'cards2 is my array****************

For i As Integer = 0 To ShuffleCards.cards2.Length - 1

'this will sort your array in ascending order
' For count = 0 To ShuffleCards.cards2.Length - 1 Step 4
For j = count + 1 To ShuffleCards.cards2.Length - 1
If ShuffleCards.cards2(count) > ShuffleCards.cards2(j) Then
ShuffleCards.cards2(count) = ShuffleCards.cards2(j)
ShuffleCards.cards2(temp) = ShuffleCards.cards2(count)
ShuffleCards.cards2(j) = temp
'temp = ShuffleCards.cards2(j)


lblPlayer1.Text += ShuffleCards.cards2(temp)
lblPlayer2.Text += ShuffleCards.cards2(temp + 1)
lblPlayer3.Text += ShuffleCards.cards2(temp + 2)
lblPlayer4.Text += ShuffleCards.cards2(temp + 3)

End If

Next j
'Next count


Next
 
Back
Top