what are the three-dimensions of an Array? and help me to create atleast 2 examples of an array program... thank you :)
Information: Most multidimensional arrays that are used are two dimensional arrays eg. databases with records and fields, screen coordinates with X and Y and record sets with rows and columns, but there are greater multidimensional arrays. There is very little documentation on these arrays. Three dimensional arrays are basically multiple two dimensional arrays layered on top of each other.Three dimensional arrays have many uses eg. mapping 3d graphics, calendars (where days are the columns, the weeks are the rows and the months are the layers), or paging methods for reports and record sets (as in the example I provided below).
Example: Private Sub Combo1_Click() 'Clear the form Me.Cls 'Set page selected Page = Combo1.Text 'Print the array info on the form For Row = 1 To UBound(Array3D, 2) For Col = 1 To UBound(Array3D, 1) Me.Print Array3D(Col, Row, Page) Next Next End Sub
Private Sub Form_Load() 'This dimensions a three element array ReDim Array3D(1, 10, 3) 'This loads data into each element of the array starting with the 'third and nesting to the first For Page = 1 To UBound(Array3D, 3) For Row = 1 To UBound(Array3D, 2) For Col = 1 To UBound(Array3D, 1) Array3D(Col, Row, Page) = Page & "-" & Row Next Next 'This will add each page number to the combo box Combo1.AddItem Page Next 'This will initially display the first page Combo1.ListIndex = 0 End Sub