The information in this article applies to:
SUMMARYVisual FoxPro 6.0 has an enhancement to the CREATE FORM command that allows you to specify a class from which the new form is created. This article demonstrates how to use this enhancement, along with a workaround for a limitation. MORE INFORMATION
In versions of Visual FoxPro prior to 6.0, the only way to specify a class
upon which to base a new form was by setting the Form Template class in the
Forms tab of the Options dialog box. Starting with Visual FoxPro 6.0, you
can create a form and specify a specific class and class library in the
CREATE FORM command. The syntax is CREATE FORM <FormName> AS <ClassName>
FROM <ClassLibraryName>. Using the CREATE FORM command in this manner
overrides any Template settings in the Options dialog box.
A new form opens in the Form Designer, based on the _form class in the
_base.vcx class library.
As documented in the CREATE FORM help topic, an error is generated if the class specified is not based on the form baseclass. This includes the case where the class is based on a formset. If you wish to create a new .scx file, based on a specific formset class, you can accomplish this by setting the Formset Template class in the Forms tab of the Options dialog box, and then select Create Form Set from the Form menu while modifying a form in the Form Designer. Alternately, you could create a new form or formset based on a specific class by issuing commands similar to the following:
These techniques were also possible in previous versions of Visual FoxPro.
Keep in mind that if you attempt to use the preceding example in versions
of Visual FoxPro prior to 6.0, you have to use SET CLASSLIB TO and the
CREATEOBJECT() function, rather than the NEWOBJECT() function.
REFERENCESVisual FoxPro 6.0 Help; search on: "CREATE FORM"; "NEWOBJECT()" © Microsoft Corporation 1998, All Rights Reserved. Additional query words: kbVFp600 kbOOP
Keywords : |
Last Reviewed: December 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |