This is what I have so far. I cant figure out why it wont work! I am so frustrated any help would be appreciated.
my instructions:
A teacher has 6 students, and wants you to create an application that stores their grade data in a file and prints a grade report. The application should have structure that stores: Name (a string), Test Scores (an array of 5 doubles), and Average ( a double) . It should have an array of 6 structure variables to match the 6 students.It should allow the user to enter the data for each student, and calculate the average test score for each. The user needs to be able to save, read and print data to/from file etc.
It should not accept scores below 0 or above 100.
Here are my additional instructions:
Do not use menu bars...Instead add buttons to read the data, save the file after the data has been updated, and exit. The button to calculate the averages should also be coded.
The initial file containing the student scores is StudentData.txt. Code this file with a location of C:\.
Add comments at the top of your code file for your name and the date. Include other comments as appropriate based on the examples in the textbook.
All controls (user interface objects on your form must have meaningful names with appropriate prefixes (for example, btnExit for an exit button).
My form:
Image may be NSFW.
Clik here to view.
my instructions:
Quote:
A teacher has 6 students, and wants you to create an application that stores their grade data in a file and prints a grade report. The application should have structure that stores: Name (a string), Test Scores (an array of 5 doubles), and Average ( a double) . It should have an array of 6 structure variables to match the 6 students.It should allow the user to enter the data for each student, and calculate the average test score for each. The user needs to be able to save, read and print data to/from file etc.
It should not accept scores below 0 or above 100.
Here are my additional instructions:
Do not use menu bars...Instead add buttons to read the data, save the file after the data has been updated, and exit. The button to calculate the averages should also be coded.
The initial file containing the student scores is StudentData.txt. Code this file with a location of C:\.
Add comments at the top of your code file for your name and the date. Include other comments as appropriate based on the examples in the textbook.
All controls (user interface objects on your form must have meaningful names with appropriate prefixes (for example, btnExit for an exit button).
My form:
Image may be NSFW.
Clik here to view.

Code:
Imports System.IO
Public Class Form1
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
' Close(program)
Me.Close()
End Sub
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
StudentScoreDataInput()
End Sub
End Class
Module StudentTestScoresModule
Const intMAX_SUBSCRIPT_STUDENT As Integer = 6
Const intMAX_SUBSCRIPT_STUDENT_SCORES As Integer = 5
'create structure
Public Structure StudentData
Dim strName As String
Dim dblTestScoresArray() As Double
Dim dblAverage As Double
End Structure
Dim dblScore As Double
Dim StudentsArray(intMAX_SUBSCRIPT_STUDENT) As StudentData
Sub StudentNameDataInput()
StudentsArray(0).strName = Form1.txtName1.Text
StudentsArray(1).strName = Form1.txtName2.Text
StudentsArray(2).strName = Form1.txtName3.Text
StudentsArray(3).strName = Form1.txtName4.Text
StudentsArray(4).strName = Form1.txtName5.Text
StudentsArray(5).strName = Form1.txtName6.Text
End Sub
Sub StudentScoreDataInput()
For intIndex = 0 To intMAX_SUBSCRIPT_STUDENT
ReDim StudentsArray(intIndex).dblTestScoresArray(4)
Next
'initialize test scores for first student in the array
StudentsArray(0).dblTestScoresArray(0) = CDbl(Form1.txtS11.Text)
StudentsArray(0).dblTestScoresArray(1) = CDbl(Form1.txtS12.Text)
StudentsArray(0).dblTestScoresArray(2) = CDbl(Form1.txtS13.Text)
StudentsArray(0).dblTestScoresArray(3) = CDbl(Form1.txtS14.Text)
StudentsArray(0).dblTestScoresArray(4) = CDbl(Form1.txtS15.Text)
'initialize test scores for second student in the array
StudentsArray(1).dblTestScoresArray(0) = CDbl(Form1.txtS21.Text)
StudentsArray(1).dblTestScoresArray(1) = CDbl(Form1.txtS22.Text)
StudentsArray(1).dblTestScoresArray(2) = CDbl(Form1.txtS23.Text)
StudentsArray(1).dblTestScoresArray(3) = CDbl(Form1.txtS24.Text)
StudentsArray(1).dblTestScoresArray(4) = CDbl(Form1.txtS25.Text)
'initialize test scores for third student in the array
StudentsArray(2).dblTestScoresArray(0) = CDbl(Form1.txtS31.Text)
StudentsArray(2).dblTestScoresArray(1) = CDbl(Form1.txtS32.Text)
StudentsArray(2).dblTestScoresArray(2) = CDbl(Form1.txtS33.Text)
StudentsArray(2).dblTestScoresArray(3) = CDbl(Form1.txtS34.Text)
StudentsArray(2).dblTestScoresArray(4) = CDbl(Form1.txtS35.Text)
'initialize test scores for fourth student in the array
StudentsArray(3).dblTestScoresArray(0) = CDbl(Form1.txtS41.Text)
StudentsArray(3).dblTestScoresArray(1) = CDbl(Form1.txtS42.Text)
StudentsArray(3).dblTestScoresArray(2) = CDbl(Form1.txtS43.Text)
StudentsArray(3).dblTestScoresArray(3) = CDbl(Form1.txtS44.Text)
StudentsArray(3).dblTestScoresArray(4) = CDbl(Form1.txtS45.Text)
'initialize test scores for fifth student in the array
StudentsArray(4).dblTestScoresArray(0) = CDbl(Form1.txtS51.Text)
StudentsArray(4).dblTestScoresArray(1) = CDbl(Form1.txtS52.Text)
StudentsArray(4).dblTestScoresArray(2) = CDbl(Form1.txtS53.Text)
StudentsArray(4).dblTestScoresArray(3) = CDbl(Form1.txtS54.Text)
StudentsArray(4).dblTestScoresArray(4) = CDbl(Form1.txtS55.Text)
'initialize test scores for sixth student in the array
StudentsArray(5).dblTestScoresArray(0) = CDbl(Form1.txtS61.Text)
StudentsArray(5).dblTestScoresArray(1) = CDbl(Form1.txtS62.Text)
StudentsArray(5).dblTestScoresArray(2) = CDbl(Form1.txtS63.Text)
StudentsArray(5).dblTestScoresArray(3) = CDbl(Form1.txtS64.Text)
StudentsArray(5).dblTestScoresArray(4) = CDbl(Form1.txtS65.Text)
Dim intList1 As New List(Of Integer)
Dim intList2 As New List(Of Integer)
Dim intList3 As New List(Of Integer)
Dim intList4 As New List(Of Integer)
Dim intList5 As New List(Of Integer)
Dim intList6 As New List(Of Integer)
' First Student Average
intList1.AddRange(New Integer() {CInt(Form1.txtS11.Text), CInt(Form1.txtS12.Text), CInt(Form1.txtS13.Text), CInt(Form1.txtS14.Text), CInt(Form1.txtS15.Text)})
Form1.lblAvg1.Text = intList1.Average.ToString
' Second Student Average
intList2.AddRange(New Integer() {CInt(Form1.txtS21.Text), CInt(Form1.txtS22.Text), CInt(Form1.txtS23.Text), CInt(Form1.txtS24.Text), CInt(Form1.txtS25.Text)})
Form1.lblAvg2.Text = intList2.Average.ToString
' Third Student Average
intList2.AddRange(New Integer() {CInt(Form1.txtS31.Text), CInt(Form1.txtS32.Text), CInt(Form1.txtS33.Text), CInt(Form1.txtS34.Text), CInt(Form1.txtS35.Text)})
Form1.lblAvg3.Text = intList3.Average.ToString
' Fourth Student Average
intList2.AddRange(New Integer() {CInt(Form1.txtS41.Text), CInt(Form1.txtS42.Text), CInt(Form1.txtS43.Text), CInt(Form1.txtS44.Text), CInt(Form1.txtS45.Text)})
Form1.lblAvg4.Text = intList4.Average.ToString
' Fifth Student Average
intList2.AddRange(New Integer() {CInt(Form1.txtS51.Text), CInt(Form1.txtS52.Text), CInt(Form1.txtS53.Text), CInt(Form1.txtS54.Text), CInt(Form1.txtS55.Text)})
Form1.lblAvg5.Text = intList5.Average.ToString
' Sixth Student Average
intList2.AddRange(New Integer() {CInt(Form1.txtS61.Text), CInt(Form1.txtS62.Text), CInt(Form1.txtS63.Text), CInt(Form1.txtS64.Text), CInt(Form1.txtS65.Text)})
Form1.lblAvg6.Text = intList6.Average.ToString
End Sub
Sub CalculateAverage()
End Sub
End Module