The information in this article applies to:
- Microsoft Visual FoxPro for Windows, version 3.0
SUMMARY
This article shows by example how to pass an array to a form.
MORE INFORMATION
Step-by-Step Example
- In the Command window, enter the following commands:
DIMENSION array1(3)
array1(1) = "One"
array1(2) = "Two"
array1(3) = "Three"
MODIFY FORM passarray &&& Create a new form
- On the Form menu, click New Property, and name the property Array2(1).
- In the form's Init event, place the following lines of code:
PARAMETER Array1
DIMENSION This.Array2(ALEN(Array1))
=ACOPY(Array1, This.Array2)
THISFORM.List1.NumberOfElements=ALEN(THISFORM.Array2)
THISFORM.Refresh
- Place a list box on the form, and set the following properties for the
list box:
- Set the RowSource property to: THISFORM.Array2.
- Set he RowSourceType property to: 5-ARRAY.
- Save the form, and run it from the Command window with the following
command line:
DO FORM PASSARRAY WITH ARRAY1
- The elements from Array1 will be shown in the list box. Use the scroll
bar if they are not all visible.
|