Why am I getting a Null Reference when I assign a value to the array 'arrCourse' in my code. I declared the array outside of all methods in the main Form. The only reason I want to assign 0 to the first Index is because when I tried Double.Parse I also got a Null reference.
Imports System.IO
Public Class frmScore
Public studentReport As StreamWriter
'studentReport = File.CreateText("reportCards.txt")
'Put this declaration into a method
Public Structure StudentRecords
Public strName As String
Public arrCourseGrade() As Double
Public dblAverage As Double
End Structure
Public student1 As StudentRecords
'Calculating Averages
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
student1.arrCourseGrade(0) = 1
student1.arrCourseGrade(1) = 2
If Double.TryParse(txtS1Course1.Text, student1.arrCourseGrade(0)) Then
Else
MessageBox.Show("Student 1, Course 1 grade, must be numeric")
End If
End Sub
End Class