Hello, we have to create a football scoreboard in Visual Basic.
Purpose: The application calculates the points scored during a football game by one team
Requirements:
1. The user clicks the enter score button in an input box object to enter a score after the football team scores
2. Each score and running total are displayed in a list box
3. After the user clicks the cancel button in the input box object to end the game scoring the total final score is displayed
4. A file menu with a clear (clears scores and results) and exit (closes app)

Restrictions
1. Non numeric values shall not be accepted
2. Negative value should not be accepted

I am really struggling in this class so I used some example code for another project from the book. The first problem I'm having is when I go and run the program and type in the first number I get the negativenumber error. I'm also not sure if the program will actually run (again I am very lost in the class) If anyone could take a look and tell me where I am going wrong I would really appreciate it.
Thank you.

[Public Class footballfever

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuexit.Click
Close()
End Sub

Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuclear.Click
lstScoreBox.Items.Clear()
lblfinalscore.Visible = False
btnEnterScore.Enabled = True

End Sub

Private Sub btnEnterScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterScore.Click
Dim strscore As String
Dim decscore As Decimal
Dim decfinalscore As Decimal = 0D
Dim strinputboxmessage As String = "enter the score for game #"
Dim strinputboxheading As String = "football score"
Dim strnormalboxmessage As String = "enter the score for game #"
Dim strnonnumericerror As String = " Error - enter a number for the score #"
Dim strnegativeerror As String = "Error please enter a positive number for score #"
Dim dectotalscore As Decimal
Dim strcancelbuttonclicked As String = ""
Dim intmaxnumberofentries As Integer = 10
Dim intnumberofenteries As Integer = 1

strscore = InputBox(strinputboxmessage & intnumberofenteries, _
strinputboxheading, " ")
Do
Do Until intnumberofenteries > intmaxnumberofentries _
Or strscore = strcancelbuttonclicked

If IsNumeric(strscore) Then
decfinalscore = Convert.ToDecimal(strscore)
If decscore > 0 Then
Me.lstScoreBox.Items.Add(decscore)
decfinalscore += decscore
intnumberofenteries += 1
strinputboxmessage = strnormalboxmessage
Else
strinputboxmessage = strnegativeerror


End If

Else
strinputboxmessage = strnonnumericerror
End If

If intnumberofenteries <= intmaxnumberofentries Then
strscore = InputBox(strinputboxmessage & intnumberofenteries, _
strinputboxheading, " ")
End If
Loop
lblfinalscore.Visible = True

If intnumberofenteries > 1 Then
decfinalscore = dectotalscore + decscore
lblfinalscore.Text = "Average score per game is " & _
decfinalscore.ToString("F1") & "average score"
Else
Me.lblfinalscore.Text = "no score entered"

End If
btnEnterScore.Enabled = False

Loop

End Sub

End Class]

That should get you started. Use your documentation to find out which methods to use. I hope you have not waited till the last minute!

Public Class frmScoreBoard

    Private Sub bnEnterScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnEnterScore.Click
        Dim strScore As String
        Dim intTotal As Integer, intCounter As Integer

        strScore = InputBox("Enter Score", "Score!", "0")
        If IsNumeric(strScore) Then
            ' Add Code Here add item to the list box. Use your help file
            ' under the Index Tab input InputBox to find help on how to use the function.
        ElseIf (strScore = ' ? ' Check documentation for InputBox to see what the return value will be if the user presses the cancel button.
            For intCounter = 0 To lstResults.Items.Count - 1
                ' intTotal =  ' Add code to accumulate the total for the score
            Next
            ' Enter Total 
            ' Use methods from the list box control to add the item to the list.
        Else
            Exit Sub
        End If
    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Application.Exit()
    End Sub

    Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
        ' Use methods from the list box control to clear the list.
    End Sub

    Private Sub frmScoreBoard_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.