WARNING! Do not proceed unless you have looked at and understood the topics called “Custom Classes” and “Arrays“. We will be creating an array of a custom class.

Databases and Data Structures

Data structures are used to organize and manage data. The type of data structure we will be examining is like a table in a database so let’s begin by clarifying what a database table is. A table is made up of several columns into which data can be entered like this:


For those familiar with FileMaker Pro terminology the names used are different but their functional meanings are the same:
Table = Layout
Column = Field
Row = Record

The programmer creates the table by deciding what columns (fields) it should have. A Table (Layout) can have as many columns (fields) as the programmer deems necessary.

Rows (records) are added to a table by the user when he or she inputs data into the table’s columns (fields).

A table then, is like a multi-columned listbox. The difference is that a table exists in memory or in a database file; not on a project window as does a listbox. As we will see this can be very helpful in certain situations.

Because of their structural compatibility listboxes are very commonly used to display table data and database tables are often used to store data that has been entered into a listbox.

On to Data Structures

A data structure is a database-like structure that we can create from scratch. For the purposes of this discussion let’s assume that we are going to create a data structure that manages first names and last names of clients. We’re keeping it simple so we won’t worry about client addresses, phone numbers, etc.

We will use a custom class called “box1Data” to create the data structure. box1Data will have two properties: firstName as string, and lastName as string.
(For more about custom classes see the topic called “
Custom Classes“.)



We will also need to create some global properties so we need to add a module to the project called “dataGlobals”. This module will have two properties: box1Array(0) as box1Data and gBox1Count as integer.


With the first property, “box1Array(0) as box1Data”, we create an array of box1Data class objects. When box1Data objects are added to this array each object will be like the rows of a database. Each box1Data object in the array will have its own firstName and lastName properties to hold client first and last names.
(For more about arrays see the topic “



Next page