Hi,
let's hope I can explain this clearly! I have a Structure, and I am having trouble initialising it. Specifically when I try to populate the Vector3 variables, it tells me that they are Nothing, so I need to make them New when the array of this structure is declared.
Next, I added a Sub New to the structure:Code:Structure tTrackPoint Dim id Dim obj As DarkGDK.Basic3D.Cube Dim pos As DarkGDK.Math.Vector3 Dim handle1 As DarkGDK.Math.Vector3 Dim handle2 As DarkGDK.Math.Vector3 Dim handle1Obj As DarkGDK.Basic3D.Cube Dim handle2Obj As DarkGDK.Basic3D.Cube Dim width As Double End Structure
Now my problem is that I must supply a parameter, the syntax error being:Code:Public Sub New() pos = New DarkGDK.Math.Vector3 handle1 = New DarkGDK.Math.Vector3 handle2 = New DarkGDK.Math.Vector3 End Sub
Structures cannot declare a non-shared 'Sub New' with no parameters.
I have no parameter to supply, and this will be an array so I'm not even sure how I would supply it.
The second option to fix the error is to make the Sub New shared, but then I get other errors:
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Does anyone know how I can resolve this. My end goal is to have an array of this structure type with the Vector3s ready to use.




Reply With Quote