Article ID: | qOOP014 |
Date Revised: | July 14, 1997 |
Keywords: | object array property |
See Also: | qOOP007 |
Question: How do I create an array object property?
Answer: In the class designer when you create an array property, add [1] to the end to signify an array. You can put the number of array elements that you want in the definition of the property, or you can later redimension the array in any of the normal VFP ways to redimension it.
For example you are going to use an form array to hold a list of items to choose from for a ComboBox. Define the array property using Form/New Property menu item make the name aStates[1]. Then in the form Init() method you could:
select cStateAbbr, cStateName ;
from states ;
into array thisform.aStates ;
order by cStateAbbr
thisform.cboStates.Requery() && tell the cbo to update itself.