AINSTANCE( ) Function

Example   See Also

Places instances of a class into a variable array and returns the number of instances placed in the array.

Syntax

AINSTANCE(ArrayName, cClassName)

Returns

Numeric

Arguments

ArrayName

Specifies the name of the array into which the instances are placed. If the array you specify doesn't exist, Visual FoxPro automatically creates the array. If the array exists and isn't large enough to contain all the instances, Visual FoxPro automatically increases the size of the array to accommodate the instances. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and AINSTANCE( ) returns 0 because no instances are found, the array remains unchanged. If the array doesn't exist and AINSTANCE( ) returns 0, the array is not created.

Only class instances assigned to variables and array elements with CREATEOBJECT( ) are placed into the array.

cClassName

Specifies a Visual FoxPro base class name or a user-defined class name. The following table lists the Visual FoxPro base classes you can specify for cClassName:

Base class names
ActiveDoc Label
CheckBox Line
Column ListBox
ComboBox OLEControl
CommandButton OLEBoundControl
CommandGroup OptionButton
Container OptionGroup
Control Page
Cursor PageFrame
Custom ProjectHook
DataEnvironment Relation
EditBox Separator
Form Shape
FormSet Spinner
Grid TextBox
Header Timer
Hyperlink ToolBar
Image