Using a 3 Dimensional Array
Category:Lists, Collections and Arrays
Most multi-dimensional arrays that are used are two dimensional arrays eg. databases with records and fields, screen coordinates with X and Y and recordsets with rows and columns, but there are greater multi-dimensional 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 recordsets (as in the example I provided below).
The code shows how to:
- Dimension a 3 dimensional array
- Populate the array
- Access each layers data seperately
- Print the data
Instructions: Copy the declarations and code below and paste directly into your VB project.