This example form shows how to create a collection of employees and  to add items to the collection. In this example the collection is used simply like an array.
When you type in an employee name and click on the Save button, the employee name is saved in a collection.

When you click on the Show button, all employees entered in the collection are displayed in a message box.

When the application ends, the entries in the collection are cleared.
Define the Collection
The collection to store employee names is defined like this:
Define_Com Class(#Prim_kCol<#FullName #Std_Num>) Name(#Employee)

Add Items to the Collection

The code to Save the employee's full name into the keyed collection is contained in the Click event of the Save button:
 
Change Field(#LISTCOUNT) To('#Employee.ItemCount + 1')
Set Com(#Employee<#ListCount>) Value(#FullName.Value)
In the above note that:

Work with the Collection Items

Individual items in the collection are accessed using a For/EndFor loop.
The click event of the Show button iterates through the collection referencing each entry in the collection by using a For/EndFor loop to retrieve the value of  #FullName of the individual employees to a message box:
 
For Each(#EmployeeFullName) In(#Employee)
Use Builtin(MESSAGE_BOX_ADD) With_Args('Employee' #EMPLOYEEFULLNAME.VALUE 'was found in the collection.')
Endfor
Source Code for Collection Example 1
To see how a collection is created, copy and paste this code to a form and then compile and execute the form.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(88) Clientwidth(363) Height(115) Left(269) Top(185) Visualstyle(#VS_NORM) Width(371)