View Single Post
Old Jun 30th, 2007, 10:56 AM   #1
boatn19
Newbie
 
Join Date: May 2005
Location: Charleston, SC
Posts: 11
Rep Power: 0 boatn19 is on a distinguished road
not displaying lowest number

I am trying to display the lowest number using the for...each statement.
What is happening is either I get it to display the second number or the last number. Is my if statement in the correct location for starters and does it look the way it should or is it as messed up as me?


 
       Dim scores() As Integer = {78, 87, 95, 94, 77, 82, 81, 82, 65, 45, _
                                   66, 54, 32, 24, 100, 78, 86, 13, 92, 91}
        Dim lowest As Integer
        Dim x As Integer = 1

        For Each lowest In scores
            If scores(x) < lowest Then lowest = scores(x)

        Next lowest
        Me.xLowestLabel.Text = lowest.ToString()
    End Sub
boatn19 is offline   Reply With Quote