i need to populate an array with grades. there is an 'add students & grades' button. user is prompted by input box to enter a students name, then another input box to enter their grade. the student's name is displayed in a list box. but the grades need to be stored in an array. here is a portion of my code:
I'm stuck populating the array? any advice would be great. thanks.
Code:
Public Class btnAdd
Dim grades() As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim name As String = InputBox("please enter a student's name.")
'validate name
Do While Not isvalidname(name)
name = InputBox("please enter a student's name.")
Loop
'display info
lstStudents.Items.Add(name)
'validate grade
Dim grade As String = InputBox("please enter a positive number for grades.")
Do While Not IsPositiveNumber(grade)
grade = InputBox("please enter a positive number for grades.")
Loop
'populate array
Dim i As Integer
For i = 0 To grades.GetUpperBound(0)
grades(i) = Val(grade)
Next
End Sub