Hi
I need to create public class (accessible from all forms) e.g. like
this:
item: mainfrm.storage.item(0).bitmap to be array (10,10)
item:
mainfrm.storage.item(1).bitmap to be array (20,10)
so you see I need to
add item everytime with different array dimension,but I need to
add this item also from other forms than main.. I don't know if there is some possibility to add item and redim it's attributes range...
Details:
Application is my improved Life program, but there is possible to create initial maps
of different sizes, more colors (beeings) and more rules for these colors
(two types of rules: I/O mask, and range, where I/O mask controls some points around
and if it is the same like in input mask it creates new beeings like defined in output mask; range method controls mass of some colors in some range, and it uses output mask, if masses of colors are equal with rule definitions)
-----------------------------------------------------------------------
Needed Hierarchy:
Storage.Colors.Count
.Item(n).Name
.Rules.Count
.Item(n).Mask.Input.Count
.Item(n).color
.x
.y
.Output.Count
.Item(n).color
.x
.y
.Name
.Region.Item(n).Color
.Mass
.Range
.Output.Item(n).Color
.x
.y
.Type
.Value
.Maps.Initial.Count
.Item(n).Bitmap(,)
.Name
.Size.Width
.Height
.Unit.Count
.Item(n).Bitmap(,)
.Name
.Size.Width
.Height
.Sets.Count
.Item(n).Colors.Count
Item(n).Colornum
.Rules.Count
Item(n).Rulenum
.Name
------------ This is code I created, green are problematic parts
Public Class life_storage
Public Class colors_container
Public Class color_item
Public Class rules_container
Public Class rule_item
Public Class mask_dev
Public Class mask_particle
Public x As Integer
Public y As Integer
Public color As Integer
End Class
Public count As Integer
Public item(30) As mask_particle '--------------- mask size
End Class
Public Class mask_container
Public input As mask_dev
Public output As mask_dev
End Class
Public Class region_container
Public Class range_item
Public range As Integer
Public color As Integer
Public mass As Integer
End Class
Public item(10) As range_item '--------------- ranges per rule
Public output As mask_dev
End Class
Public type As Integer
Public name As String
Public mask As mask_container
Public region As region_container
End Class
Public item(50) As rule_item '--------------- rules per color
Public count As Integer
End Class
Public rules As rules_container
Public value As Integer
Public name As String
End Class
Public item(50) As color_item '--------------- colors possible
Public count As Integer
End Class
Public colors As colors_container
Public Class sets_container
Public Class sets_item
Public Class set_colors_container
Public Class set_coloritem
Public Class set_rules_container
Public Class set_ruleitem
Public rulenum As Integer
End Class
Public count As Integer
Public item(50) As set_ruleitem '============= rules per set
End Class
Public rules As set_rules_container
Public colornum As Integer
End Class
Public count As Integer
Public item(50) As set_coloritem '=========== colors per set
End Class
Public name As String
Public colors As set_colors_container
End Class
Public item(10) As sets_item
Public count As Integer
End Class
Public sets As sets_container
Public Class maps_container
' maps subcontainer
Public Class map_point
Public x As Integer
Public y As Integer
Public color As Integer
End Class
Public Class map_size
Public width As Integer
Public height As Integer
End Class
Public Class initial_map
Public Class map_item
Public size As map_size
Public bitmap(,) As Integer
Public name As String
End Class
Public item(20) As map_item
Public count As Integer
End Class
'map units subcontainer
Public Class map_unit
Public Class map_unit_item
Public size As map_size
Public bitmap(,) As Integer
Public name As String
End Class
Public item(20) As map_unit_item
Public count As Integer
End Class
Public initial As initial_map
Public unit As map_unit
End Class
Public maps As maps_container
End Class

How to create item in class, which can have array attributes with different dimensions
BMEMBERG
Hi,
I think ReDim statement can help you do this.
Dim array1 As Array(,)
ReDim array1(10, 20)
mainfrm.storage.item(0).bitmap = array1
Dim array2 As Array(,)
ReDim array2(20, 20)
mainfrm.storage.item(1).bitmap = array2
Best regards,