Start New Discussion within our Software Development Community

I have to write a small program that averages the scores for an array of baseball players for 4 seasons. I'm having problems with 2 parts of my program.

First, I need to write an event handler for the TextChanged event that searches the input when the user types info into the combobox, and if it matches an entry, display that info from the array into a listbox.

Second, I need to write a loop that checks each average of each player, and places his name in a listbox IF 3 out of 4 of his scores were above average in comparison to his fellow players for that same season.

Any idea where I would start? I have the code written out up until that point, but now I'm lost. Just looking for a general idea of where to go from here.

OK I guess the question is rather broad. I did get somewhere in the code, but I am stuck again. It gives me the average in the listbox but no matter what the average is, it is saying "Below Average". What am I doing wrong?

Private Sub cboPlayerNamen_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboSalesperson.TextChanged

Dim Found As Boolean
Dim Position As Integer = 0
Dim Name As String
Static Message As String


If txtSeason1.Text < txtAvg1.Text Then
Message = "- Below Average"
ElseIf txtSeason1.Text = txtAvg1.Text Then
Message = "- Average"
ElseIf txtSeason1.Text > txtAvg1.Text Then
Message = "- Above Average"
End If

---Then I do the same for season 2,3, and 4--------

Name = cboPlayers.Text

Search(Name, Found, Position)
If Found Then
lstAverages.Items.Add("S1: " & (intSeason1(Position) & " " & Message))
lstAverages.Items.Add("S2: " & (intSeason2(Position) & " " & Message))
lstAverages.Items.Add("S3: " & (intSeason3(Position) & " " & Message))
lstAverages.Items.Add("S4: " & (intSeason4(Position) & " " & Message))

End If
End Sub

This article has been dead for over six months. Start a new discussion instead.