![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Newbie
Join Date: Nov 2004
Posts: 12
Rep Power: 0
![]() |
Ok, here's how the program is supposed to work. I am creating a GUI interface that will allow the user to enter five tests into labeled text boxes which will then store the values in a single dimensional array. I must have 5 values inputed into each of the 5 text boxes for this program or it will display an error. With my code, I am trying to figure out how do I take the numbers inputted into the text box into an array which will then calculate the high, low, average, and print the scores back in the original order. For example, if I put a 90, 92, 69, 77 and 97 into the respective text boxes, what kind of changes do I need to make to my code earlier for it to recognize my inputted text box values so it could calculate what I need? Sorry if I was unclear earlier and I appreciate your help.
|
|
|
|
|
|
#12 |
|
Newbie
Join Date: Nov 2004
Location: Dilworth, MN
Posts: 15
Rep Power: 0
![]() |
KISS
Id use pretty colors again, but Pi will just "fix" them for me. To get colors you'll have to c&p this into your IDE. Next time I better RTFM.First off, if all your scores are integers, dim Highest, Lowest, Total, and A(4) as INTs. No sense hogging resources with decimal types. Second to get the values from the text box, just use VAL(txtScore1) val(txtScore2) |
|
|
|
|
|
#13 |
|
Programming Guru
![]() |
VB arrays start at 1 not 0
__________________
|
|
|
|
|
|
#14 | |
|
Newbie
Join Date: Nov 2004
Location: Dilworth, MN
Posts: 15
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#15 |
|
Newbie
Join Date: Nov 2004
Location: Dilworth, MN
Posts: 15
Rep Power: 0
![]() |
Here is the code that supposedly doesn't work. You may want to examine it to figure out where your errors are.
|
|
|
|
|
|
#16 |
|
Newbie
Join Date: Nov 2004
Location: Dilworth, MN
Posts: 15
Rep Power: 0
![]() |
GRRRRR!!!!!!!!
I Missed the freakin changes that Pi made, so the code is quite flawed. Putting my original code back in results in something that really does work. Sorry about that. I need to pay attention to "friendly" changes. |
|
|
|
|
|
#17 | |
|
Newbie
Join Date: Nov 2004
Location: Dilworth, MN
Posts: 15
Rep Power: 0
![]() |
Quote:
{2,4,3} our first pass is true and so will result in the following: If 2 > 0 then Highest = 2 The second is true, so it would be: If 4 > 2 then Highest = 4 The third pass is false so it is just: If 3 > 4 then (ignore this because its false) So, in one pass through the loop we have found our highest number. Reversing the sing (making it a "< " instead of a ">") will let us find the smallest number IF WE SET Lowest to the highest possible value (say 9999 for s&g's). This is because every value possible will be lower than this number. It's really quite simple and shouldn't require a whole page of code to figure out. Don't they teach KISS in school anymore? |
|
|
|
|
|
|
#18 |
|
Newbie
Join Date: Nov 2004
Posts: 12
Rep Power: 0
![]() |
I see what you did now Tim. There were some very suprising ways of doing this but in the end I found out what I did wrong. The Val came in handy
. Thank you all for your help. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|