The MP3car.com Store The MP3car.com Store    

Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Newbie

Reply
 
LinkBack Thread Tools Display Modes
Old 11-24-2007, 07:48 AM   #1
Newbie
 
Join Date: Nov 2007
Posts: 1
VB question

private Sub xMainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim inputscore As Integer
Dim score As Integer = 1
Dim scoreCount As Integer
Dim average As String
Dim prompt As Double
Dim title As Integer


Do While inputscore <> String.Empty
If score >= 0 Then
score = inputscore + score
scoreCount = scoreCount + 1
Else
MessageBox.Show(Text, "Total Score", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
End If

inputscore = InputBox(prompt, title, "")
average = score / scoreCount
Loop

I need a little help with this code, want to be able to enter a score from 0 to 10 and then add the total and average out the score. I have total number input box, avg score input and a total score input box. Can someone direct me into the right direction.

Thanks
Jadi15 is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 11-28-2007, 05:13 PM   #2
Maximum Bitrate
 
galvitron's Avatar
 
Join Date: Mar 2007
Location: Socal
Posts: 603
Your description is not really clear but I will try

Dim done as Boolean = false
Dim totalScore as integer = 0
Dim NumberOfScores as integer = 0

Dim inputStr as string = ""

While Not done

'Get a score
inputStr = InputBox()

'If they enter a blank string, exit loop
If inputStr = "" Then
Exit While
End If

'Check for valid integer
Dim i as integer = -1
Try
i = Convert.ToInt32(inputStr)
Catch
Continue While
End Try

'Check for between 1 and 10
If i < 0 Or i > 10 Then
Continue While
End If

totalScore += i
numberOfScores += 1

'Show current average
MsgBox("Average is now: " & (totalScore/numberOfScores).ToSting)

'Go to next input
End While
__________________
2006 Lancer Evolution IX MR In-Dash PC Project - WIP

Planning:
[----------] 100%
Purchasing:
[----------] 100%
Installation/Fab/Assembly (Revised):
[----------] 80%

galvitron is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks


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
Trackbacks are On
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any in-dash monitor with built in FM Radio QUESTION. ??? 74Camaro LCD/Display 2 05-02-2006 05:15 PM
Complete Newbie Question. DomesticImport Newbie 15 07-07-2005 06:24 PM
VB question. Arathranar Road Runner 5 06-21-2005 12:11 PM
FM Card Question.... Superbike1k Car Audio 1 05-16-2005 09:03 AM
VB Frontend rjstephens Software & Software Development 7 10-05-2002 01:22 AM


All times are GMT -5. The time now is 10:29 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics