Compartir a través de


Creating 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

Concepts

Protecting and Hiding Class Members

Reference

Adding Objects to a Container Class

SET CLASSLIB Command

CREATEOBJECT( ) Function

Other Resources

Object-Oriented Programming