Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

[HELP] Alphabetizing ListBoxes

$
0
0
Hello,

I'm working on my Final Project for my Computer Programming class, and I need some help on a problem that i've ran into.

My group is creating a Rock-Paper-Scissors Game and my part of it is making alphabetizing the scores and names.

This is most of the code that I'm currently using:
Code:

Private Sub cmdScores_Click()

Do While blnAlpha = False
    blnAlpha = True
 For bytIndex = LBound(strAlpha) To (UBound(strAlpha) - 1)
    If Trim(UCase(strAlpha(bytIndex))) > Trim(UCase(strAlpha(bytIndex + 1))) Then
        strAlpha(bytIndex + 1) = strAlpha(bytIndex)
        strTemp = strAlpha(bytIndex + 1)
        strAlpha(bytIndex) = strTemp
        blnAlpha = False
    End If
 Next
Loop

cmdScores.Enabled = False

'For bytIndex = LBound(strAlpha) To UBound(strAlpha)
'    If strAlpha(bytIndex) > " " Then                'Removes spaces when words are inputted and sent to the listbox
'    lstPName.AddItem (strAlpha(bytIndex))
'    End If
'Next

End Sub

On Form Load, I load the name from the Array and use AddItem to add random names for Sorting.

Whenever I press the button cmdScores, which should be sorting the listbox, nothing happens.

I'd appreciate any help. Thanks

Viewing all articles
Browse latest Browse all 21243

Trending Articles



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