From Inputbox to Listbox

Alright folks...I'm new to this visual basic stuff, and to the site. I am working on an assignment for a class...it'll probably look pretty easy to the rest of you, but I just can't figure it out.

What I need to do is take the information from the input box, the 'quiz scores' that are entered and put them in the list box. The way it is set up now, as you'll see is that it takes the last score and enters it all 5 times. It appears that all of my other calculations work. I'm not looking for someone to completely write the code for me, as I really need to and want to learn this...but maybe just a little 'shove' in the right direction?!

Below is all of the code I have so far: I changed the part I need help with to red font so you can find it quicker...Thanks!!!!!

' Purpose: Allows the user to enter 5 scores, they will be displayed in a list box
' and then can be used to calculate the average and a grade letter will
' be displayed.
' Created by: Lisa Bastian on 9/27/08

Option Strict On
Option Explicit On

Dim strInputQuiz As String
Dim intQuizCounter As Integer = 1
Dim intQuizPoints As Integer
Dim intPointsAccumulator As Integer
Dim intAverage As Integer
Dim isConverted As Boolean

Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private Sub btnClear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClear.Click
lblTotalPoints.Text = ""
lblAveragePoints.Text = ""

End Sub

Private Sub btnAcceptGrades_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAcceptGrades.Click

' repeats input box until all 5 grades have been entered
Do While intQuizCounter < 6
' input box for user to enter the numeric grades

' if points entered are correct numbers count the quiz and add the points
' in the points accumulator if not show message box saying re-enter
isConverted = Integer.TryParse(strInputQuiz, intQuizPoints)
If isConverted Then
intQuizCounter = intQuizCounter + 1
intPointsAccumulator = intPointsAccumulator + intQuizPoints

Else
MessageBoxIcon.Information)

End If
Loop
[color=Red] ' Converts the Quiz Points entered to string and adds them
' to the list box

End Sub

Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
' uses the numeric grades entered in the list box
' to give the average grade, which will be displayed as a

lblTotalPoints.Text = Convert.ToString(intPointsAccumulator)

lblAveragePoints.Text = Convert.ToString(intPointsAccumulator / 5)

intAverage = CInt(Convert.ToString(intPointsAccumulator / 5))
lblAveragePoints.Text = Convert.ToString(intAverage)

Select Case intAverage
Case Is >= 93
Case Is >= 86
Case Is >= 77
Case Is >= 70
Case Else
End Select

' displays the letter grade in the label
End Sub
End Class

• Pennsylvania, USA
If I understand correctly, you want to prompt the user to enter a value and then add that to your listbox? I have found that "InputBoxes" are annoying to the user, but if this is a tool for yourself or your IT Dept, then it shouldn't be too bad. If you will have a lot of end users, I would suggest having a button skim values from textboxes.

To do what you want:

[code]
Dim Val as String = ""
Dim dPercent as Double = 0

Val = InputBox("Please enter a Quiz Score.", "Score")
If isNumeric(Val) then
dPercent = cDbl(Val)
'any other code you'd like, we just filled dPercent with the entered quiz score
MsgBox("You entered a numeric value of " & dPercent.toString())
Else
MsgBox("You must enter a numeric value.)
End If

[/code]

So let's say for instance you would like to continue to prompt the user until he enters a good value. This would be how you do that.

[code]
Dim Val as String = ""
Dim dPercent as Double = 0
Dim Resolve as Boolean = false

Do While Not Resolve

Val = InputBox("Please enter a Quiz Score.", "Score")

If isNumeric(Val) then
dPercent = cDbl(Val)
Resolve = True
Else
End If

Loop

[/code]

Happy Coding,
FireSickle.com