Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 30th, 2007, 11: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
Old Jun 30th, 2007, 12:05 PM   #2
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 422
Rep Power: 4 Wizard1988 is on a distinguished road
Look at your x variable, what is it supposed to do?
__________________

Wizard1988 is offline   Reply With Quote
Old Jul 2nd, 2007, 4:29 PM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
x needs to put its best foot forward
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
c-unix-childprocesses-random number programmingnoob C 7 Feb 6th, 2007 9:39 PM
Jython Jessehk Coder's Corner Lounge 2 Feb 5th, 2006 5:35 AM
[tutorial] Python for programming beginners coldDeath Python 30 Dec 14th, 2005 12:35 PM
FiveDigit + RandomeNumber Game. TecBrain Java 0 Nov 18th, 2005 3:53 PM
pointer number alteration Blighttdm C 5 Oct 14th, 2005 8:24 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:26 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC