eipisquared
Programmer
This seems straight forward and simple...I want to create an array as one of the elements inside my structure, but when I go to run the code it gives me an exception...HELP!!!
Public Class Form1
Private Structure Polynomial
Dim degree As Int16
Dim coeffArray() As Double
End Structure
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myPolynomials(10) As Polynomial
myPolynomials(1).degree = 3
myPolynomials(1).coeffArray(0) = 3 'I get the "Object reference not set to an instance of an object" error.
myPolynomials(1).coeffArray(1) = 2
myPolynomials(1).coeffArray(2) = -4
myPolynomials(1).coeffArray(3) = 5
End Sub
End Class
What the heck is wrong with this??? Wasn't this allowed in the past?
Public Class Form1
Private Structure Polynomial
Dim degree As Int16
Dim coeffArray() As Double
End Structure
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myPolynomials(10) As Polynomial
myPolynomials(1).degree = 3
myPolynomials(1).coeffArray(0) = 3 'I get the "Object reference not set to an instance of an object" error.
myPolynomials(1).coeffArray(1) = 2
myPolynomials(1).coeffArray(2) = -4
myPolynomials(1).coeffArray(3) = 5
End Sub
End Class
What the heck is wrong with this??? Wasn't this allowed in the past?