As Benoît says,
Dim Normals As New Tile_Normals[TileGrid.Size, TileGrid.Size]
only gives an array where you can store references to Tile_Normals.

You also have to do:
Dim I As Integer
Dim J As Integer
For I = 0 To TileGrid.Size - 1
  For J = 0 To TileGrid.Size - 1
    Normals[I, J] = New Tile_Normals
  Next
Next

Otherwise you will get "null object" errors.

/Emil

2012/7/4 Benoît Minisini <gam...@users.sourceforge.net>

> Le 04/07/2012 06:06, Kevin Fishburne a écrit :
> > I need to create a 2D array of a structure like this:
> >
> > Public Struct Tile_Normals
> >     A[3] As Single  ' Normal for quad subsurface A.
> >     B[3] As Single  ' Normal for quad subsurface B.
> > End Struct
> >
> > Dim Normals As New Tile_Normals[TileGrid.Size, TileGrid.Size]
>
> --> There Tile_Normals is used like a class, not a structure.
>
> You must initialize each element of the array with a new Tile_Normals
> object (in other words, you can use a normal class instead of a structure).
>
> Or you can use embedded array of structures:
>
> Private Normals[10, 10] As Struct Tile_Normals
>
> But then the size of the array must be known at compile time!
>
> --
> Benoît Minisini
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to