Dim x As Integer Private Sub cmdShow_Click() lblAnswer.Caption = average End Sub Private Sub cmdStart_Click() x = Val(InputBox("Enter the number of courses: ", "Number of courses: ")) For y = 2 To x Load txtGrade(y) txtGrade(y).Visible = True txtGrade(y).Top = txtGrade(y - 1).Top + 50 + txtGrade(y - 1).Height + 50 Next For y = 2 To x Load txtHours(y) txtHours(y).Visible = True txtHours(y).Top = txtHours(y - 1).Top + 50 + txtHours(y - 1).Height + 50 Next End Sub Private Function average(grade() As Integer) As Double Dim total As Double grade() = Val(txtGrades()) For y = 1 To x total = total + grade(y) average = total / x Next End Function
please help me... i don't know why i can't access my array when i'm computing for the average and displaying it.
Here's the problem, please guide me if my codes are on the right track.. PLEASE... (
*** Write a program to compute a student's grade point average. the program should use Input Box in the Form_load event procedure to request the number of courses to be averaged and then create elements in two text box to hold the grade and semester hours credit for each course. after the student fills in these text boxes and clicks on a command button, the program should use a function to compute the grade- point average. a sub procedure should display the GPA and then display one of the two messages. a student with a GPA of 3 or more should be informed that he has made it to the honor roll. otherwise, the student should be congratulated on having completed the semester, in either case, the student should be wished a merry vacation.
THANK YOU SO MUCH!!!!