Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2004, 02:02 PM
Authorized User
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display highest test score

I have written this small vb.net program that a user can enter a test score and each time that they do, it displays the average test score and the number of test scores. I am confused though regarding the code to display the highest test score. Any help would be appreciated.

 
Old November 9th, 2004, 02:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Are you storing the results in a database? If so you can use a Select statement to pull the highest value for the test scores.

Like:

SELECT Max([TestScore]) FROM [TableName]

Replace "TestScore" with the column name(without brackets) for your test scores. Replace "TableName"(without brackets) with your table's name.

If you aren't using a database, please post some code and give a little more info. It makes it easier for us to help you.

J
 
Old November 9th, 2004, 02:58 PM
Authorized User
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No I am not. The user just enters a test score each time they press enter

 
Old November 9th, 2004, 04:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

So how are you keeping track of the test scores? Are you storing them in an array?

J
 
Old November 9th, 2004, 04:59 PM
Authorized User
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually, I am doing a self study program and at this point I am not storing the scores anywhere yet.

 
Old November 9th, 2004, 05:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You said earlier that you were displaying average test scores and the number of test scores. How are you keeping track of these test scores?

Can you post some code and list exactly what you want? It is easier than me guessing each time.
 
Old November 9th, 2004, 06:53 PM
Authorized User
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Operation
• The user enters a test score ranging from 0 to 100 and then clicks the Enter score button or presses the Enter key to activate that button.
• For each score, the application adds one to the number of scores, calculates the average score, and determines what the best score is so far. Then, it displays the results.
• To clear the results so the user can enter another set of scores, the user clicks on the Reset button.

This is the project that I am working on. I have been able to do the code for the average score and number of scores.

 
Old November 9th, 2004, 08:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

So I assume you are assigning these values to variables? Adding the new test score to a current total and then dividing that by the total number of tests + 1 (the new test).

I guess one way to do it would be to create a new numeric variable and assign to it the first test's value. Upon each submission you could compare the current test's value with the value stored in the variable. If it is greater, it replaces the variable's value with it's own.

J
 
Old November 9th, 2004, 08:05 PM
Authorized User
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for your input.

 
Old November 9th, 2004, 08:11 PM
Authorized User
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That is exactly what I am doing. How would that part be coded. Can you give an example.

Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Algorithm to Score Global Quality-Quantity of File asgarcymed VBScript 0 November 24th, 2007 11:12 PM
Coursebuilder Score Script fs22 Javascript 0 April 8th, 2004 09:37 AM
get max test score and corresponding date ssambr1 MySQL 1 January 24th, 2004 08:42 PM
quiz total score frenziedsilence Beginning PHP 2 January 14th, 2004 12:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.