ok. this may be very very hard for me to explain. But please i need help!
Here is the class file and the functions im dealing with inside of it:
Here is the code in the module and the functions im dealing with:Code:Private Type Structure Name As String Health As Integer DamageToGive As Integer Power As Integer GridLocation As String End Type Dim Structure() As Structure Sub StructureCount(Value As Long) ReDim Preserve Structure(0 To Value) As Structure End Sub Property Get GridLocation(index As Integer, Optional StructureName As String) If Len(StructureName) > 0 Then For i = 0 To UBound(Structure) If Structure(i).Name = StructureName Then GridLocation = Structure(i).GridLocation Exit For End If Next i Else GridLocation = Structure(index).GridLocation End If End Property Sub SetGridLocation(ClickedIndex As Integer, mLeft As Integer, mDown As Integer, mRow As Integer, index As Integer, Optional StructureName As String) Dim BuildArray As String If Len(StructureName) > 0 Then For i = 0 To UBound(Structure) If Structure(i).Name = StructureName Then Structure(i).GridLocation = GetGridLocation(ClickedIndex, mLeft, mDown, mRow) End If Next i Else Structure(index).GridLocation = GetGridLocation(ClickedIndex, mLeft, mDown, mRow) 'SUBSCRIPT OUT OF RANGE FROM BuildIt() End If End Sub
Code:Private Building As New StructureController Function BuildIt() MsgBox Building.GridLocation(0) End Function
here is the code of the main form and the commands im dealing with:
ok here is where the problem occurs.Code:Public Building As New StructureController Private Sub Form_Load() Building.StructureCount 34 Building.SetGridLocation 1, 2, 8, 15, 1 MsgBox Building.GridLocation(0) 'THIS WORKS PERFECT!!!!!! MsgBox BuildIt() 'SUBSCRIPT OUT OF RANGE!!!!!!! End Sub
HOW DO I FIX THIS? PLEASE HELP ME!




Reply With Quote