I'm writing a game in visual basic 2008 and things are going fairly well with it for the most part.. well until today.. I can declare a 1 dimensional array of a class just fine but cannot for the life of me get the syntax right for a multidimensiona l array. I usually don't have many issues in writing in VB but this is the first large scale program I have ever written in VB2008 and the 1st large scale uses of classes in VB as well
Here is my code to better illustrate my problem
here is the class..minus most of the properties
declaration
I instantiate the code here.. TARGET(i) works perfectly... B29CurrentZone( i)(j) does not.. gives me an error saying it needs a NEW keyword...I think i uderstand why but have no idea how to fix it..already surfed the net and could not find and adequate solution
For a work around I could do a 1 dimensional structure but I would prefer not if at all possible.. Just seems to clunky for me
Here is my code to better illustrate my problem
here is the class..minus most of the properties
Code:
Public Class Objectives private zone as Integer private TZone as integer Public Property TargetZone() As Integer Get Return TZone End Get Set(ByVal value As Integer) TZone = value End Set End Property Public Property inZone() As Integer Get return zone End Get Set(ByVal value As Integer) Zone = value End Set End Property End Class
Code:
Private Const MAXTARGETS As Integer = 102 Private Const GAZETTEER As Integer = 5 Private Target(MAXTARGETS) As B29.Objectives Private B29CurrentZone(MAXTARGETS)() As B29.Objective
Code:
Private Sub InitialTargetState() For i = 0 To MAXTARGETS - 1 For j = 0 To GAZETTEER - 1 Target(i) = New B29.Objectives B29CurrentZone(i)(j) = New B29.Objectives 'initialize zone modifiers Next j Next i End Sub
Comment