I am new to VB, and am having problems with a program. I have a textbox where the user enters a grade value, then clicks tghe add button to display the grade in a listbox. The user continues the entries until all grades have been entered. I have also programmed a remove button so that the user could select a grade int he listbox and then click the remove button to delete it from the list. When the user clicks the calculate button, I determine the total number of entries (listgrades.item.count); this value is returned correctly. I then try to copy the contents of the listbox into an array as I thought that would be the best way to determine the highest, lowest, and sum of all the grades. I would then use the sum/total to get an average. I then need to assign a letter grade to each numeric grade and display the total number of grades in each category. I obviously am not doing this correctly, as the strallgrades has a zero value.
My code is below - any assistance would be appreciated!!
'to count the number of items in the listbox total = LstGrades.Items.Count Dim curindex As Integer Dim strallgrades() As String Dim intCounter As Integer LstGrades.Items.Add(" ") For intCounter = 0 To UBound(strgrade) strallgrades(intCounter) = LstGrades.Items.Item(intCounter) Next For curindex = 0 To UBound(strgrade) Debug.WriteLine(strgrade(curindex)) Next Array.Sort(strgrade) Array.Reverse(strgrade) For curindex = 0 To UBound(strgrade) Debug.WriteLine(strgrade(curindex)) Next LblSum.Text = total End Sub