Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Highest of Ten
Message
 
To
17/04/2005 01:03:38
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01005543
Message ID:
01005569
Views:
17
This message has been marked as the solution to the initial question of the thread.
You have to loop through the List collection like this:
Private Sub Command1_Click()
Dim intI As Integer
Dim intResult As Integer

    intResult = -32767 'initialize to the lowest value
    For intI = 0 To List1.ListCount - 1
        If Val(List1.List(intI)) > intResult Then
            intResult = Val(List1.List(intI))
        End If
    Next intI
    MsgBox "the highest value is : " & intResult
End Sub
>I'm not too familiar with listboxes in VB yet so bare with me. My problem: I have to create a program that prompts the user to enter 10 numbers..each one is added to a listbox. I prompt the user with a looped inputbox. How do I run a check with a loop, to compare the numbers in the listbox to see which one is highest? Any help appreciated!
>
>-Ty Comer
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform