Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27374

Array.Sort Help

$
0
0
I'm using Windows 7 and Visual Studio 2010, programming in vb.net

here is the code and the screen results are below

Code:

Dim hands(7) As String
        For t = 0 To 0
            card = VB.Left(Seathv(t).Text, 3)
            unsortedhd(t).Text = card
            hands(t) = card

            card = VB.Mid(Seathv(t).Text, 4, 3)
            unsortedhd(t + 1).Text = card
            hands(t) = card

            card = VB.Mid(Seathv(t).Text, 7, 3)
            unsortedhd(t + 2).Text = card
            hands(t) = card

            card = VB.Mid(Seathv(t).Text, 10, 3)
            unsortedhd(t + 3).Text = card
            hands(t) = card

            card = VB.Mid(Seathv(t).Text, 13, 3)
            unsortedhd(t + 4).Text = card
            hands(t) = card

            card = VB.Mid(Seathv(t).Text, 16, 3)
            unsortedhd(t + 5).Text = card
            hands(t) = card

            card = VB.Right(Seathv(t).Text, 3)
            unsortedhd(t + 6).Text = card
            hands(t) = card

            'Array.Sort(hands)
            'Array.Reverse(hands)
            For a = 0 To 6
                hands(a) = unsortedhd(a).Text
            Next


            Array.Sort(hands)
            For a = 0 To 6
                sortedhd(a).Text = hands(a)
                'SortedSeatHV(0).Text = SortedSeatHV(0).Text + sortedhd(a).Text
            Next
            Array.Reverse(sortedhd)
            For a = 0 To 6
                'sortedhd(a).Text = hands(a)
                SortedSeatHV(0).Text = SortedSeatHV(0).Text + sortedhd(a).Text
            Next

        Next


Attachment 93803

Attachment 93805



The Red Column of Textboxes is the unsortedhd text values
The Yellow Column is the Sortedhd text values.

my problem is the results are correct except I'm always missing the highest ranking card.
my expected results should have all the values starting with the empty box down to he highest
card in the last sortedhd textbox.

I want the results of the code (first screenshot) to show black oval unsorted hand and
pink oval shows the results after sorting and combining the hand with the FlopTurnRiver cards.

This may be confusing (it is to me) to someone who
does not play poker, but I've been researching and fighting
this thing (Array.sort and Array.reverse) for several days now

Viewing all articles
Browse latest Browse all 27374

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>