[Gambas-user] gb3: using array of structures with dimensions unknown until runtime

Kevin Fishburne kevinfishburne at ...1887...
Wed Jul 4 06:06:01 CEST 2012


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]

When I try to assign a value to an array element like this:

Normals[TileGridX, TileGridY].A = Convert.Normal(P1, P2, P3)

I get a "null object" error. While the 2D array of structures seems to 
be created correctly, all its initial values are indeed "null". Do I 
need to create the structure or array differently so I can properly 
assign values to it?

Previously I knew all the dimensions of my arrays of structures so they 
were statically defined, but in this case I don't know the array 
dimensions until after the program has started running. Thanks everyone.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list