Creation of Objects from Classes

When you have saved a visual class, you can create an object based on it with the CREATEOBJECT( ) function. The following example demonstrates running a form saved as a class definition in the class library file Forms.vcx:

Creating and Showing a Form Object Whose Class Was Designed in the Form Designer

Code Comments
SET CLASSLIB TO Forms ADDITIVE
Set the class library to the .vcx file that the form definition was saved in. The ADDITIVE keyword prevents this command from closing any other class libraries that happen to be open.
frmTest = CREATEOBJECT("TestForm")
This code assumes that the name of the form class saved in the class library is TestForm.
frmTest.Show
Display the form.

See Also

Writing Class Definitions Programmatically | Protection and Hiding of Class Members | Addition of Objects to a Container Class | Programmatic Class Definitions | Object-Oriented Programming