Cant get the following program to display the decision in the listbox. Suggestions/corrections????? (visual basic 2005 Express edition)

Public Class Form1


    Dim pupil As Integer
    Dim number_of_pupils As Integer
    Dim pupilname(4) As String
    Dim age(4) As Integer
    Dim score1(4) As Integer
    Dim score2(4) As Integer
    Dim totalscore(4) As Integer
    Dim decision(4) As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        setup()
        each_pupil()
        For Me.pupil = 1 To number_of_pupils
            get_pupil_name()
            get_valid_age()
            get_valid_score()
            calculate_valid_score()
        Next
        display_results_decision()
    End Sub
    Sub setup()

        ListBox1.Items.Clear()
    End Sub
    Sub each_pupil()
        number_of_pupils = InputBox("please enter the number of pupils")
    End Sub
    Sub get_pupil_name()
        pupilname(pupil) = InputBox("Enter pupils name ...", "name")
    End Sub
    Sub get_valid_age()
        age(pupil) = InputBox("Enter pupils age ...", "age")
        While age(pupil) < 12 Or age(pupil) > 17
            MsgBox("Error!!  Please enter pupils age 12-17  ")
            age(pupil) = InputBox("Please valid age", "age")
        End While
        MsgBox("age is valid")
    End Sub
    Sub get_valid_score()
        score1(pupil) = InputBox("Enter score 1 ...", "score 1")
        While score1(pupil) < 0 Or score1(pupil) > 50
            MsgBox("Error!!  Please enter a score between 1 and 50  ")
            score1(pupil) = InputBox("Please enter a valid score ", "score 1")
        End While
        MsgBox("score 1 is valid")

        score2(pupil) = InputBox("Enter score 2 ...", "score 2")
        While score2(pupil) < 0 Or score2(pupil) > 50
            MsgBox("Error!!  Please enter a score between 1 and 50  ")
            score2(pupil) = InputBox("Please a valid score ", "score 2")
        End While
        MsgBox("score 2 is valid")
    End Sub
    Sub calculate_valid_score()
        totalscore(pupil) = score1(pupil) + score2(pupil)

    End Sub

    Sub display_results_decision()

        ListBox1.Items.Add("Pupil Name" & vbTab & vbTab & "Pupil Age" & vbTab & vbTab & "TotalScore" & vbTab & "Decision")
        For Me.pupil = 1 To number_of_pupils
            ListBox1.Items.Add(pupilname(pupil) & vbTab & vbTab & age(pupil) & vbTab & vbTab & totalscore(pupil) & vbTab & vbTab & decision(pupil) & vbTab & vbTab & vbTab & vbTab)
            If age(pupil) <= 15 Then
                If totalscore(pupil) > 70 Then
                    decision(pupil) = "Accepted to Junior orchestra"
                Else
                    decision(pupil) = "Declined"
                End If
            End If
            If age(pupil) >= 15 Then
                If totalscore(pupil) > 70 Then
                    decision(pupil) = "Accepted to Senior orchestra"
                Else
                    decision(pupil) = "Declined"
                End If
            End If
        Next
    End Sub
End Class

I have asked that this be moved to .Net. I'm sure someone over there will be able to give you your solution.:)

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.