|
-
Apr 23rd, 2013, 03:23 PM
#6
Thread Starter
New Member
Re: Sorting Arrays
I finally figured out how to sort them with the highest and lowest scores but they are being displayed from bottom to top does anyone have any idea how I can display the result in the output textbox from the highest to the lowest (top to bottom)?
Const NUM_NAMES As Integer = 4
Dim tempName As String
Dim tempTestScore As String
Dim tempBasketScore As String
Dim tempFinalScore As String
Dim swap As Boolean
For outloop = 0 To NUM_NAMES - 1
swap = False
For inloop = NUM_NAMES - 1 To outloop Step -1
If FinalGrade(inloop) > FinalGrade(inloop + 1) Then
tempFinalScore = FinalGrade(inloop)
FinalGrade(inloop) = FinalGrade(inloop + 1)
FinalGrade(inloop + 1) = tempFinalScore
tempName = StudentNames(inloop)
StudentNames(inloop) = StudentNames(inloop + 1)
StudentNames(inloop + 1) = tempName
tempTestScore = ClassTestScore(inloop)
ClassTestScore(inloop) = ClassTestScore(inloop + 1)
ClassTestScore(inloop + 1) = tempTestScore
tempBasketScore = ConicalBasketMark(inloop)
ConicalBasketMark(inloop) = ConicalBasketMark(inloop + 1)
ConicalBasketMark(inloop + 1) = tempBasketScore
swap = True
End If
Next
If Not swap Then
Exit For
End If
Next
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|