Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USING a form class

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all

Have saved a form as a class and would like to use it instead of the default form provided.

How do I do this.

SparePart
 
Hi SparePart,

Instead of DO FORM MyForm NAME MyVarName LINKED WITH MyParm

you would use the NewObject or CreateObject commands.

Example 1:
SET CLASSLIB TO MyClass ADDITIVE
OR
SET PROCEDURE TO MyProcedure ADDITIVE && if it's defined in a procedure file
oMyFormRef=CREATEOBJECT('MyFormClassName',MyParm)
oMyFormRef.Show()

Example 2:
oMyFormRef=NEWOBJECT('MyFormClassName','MyClassLib','',MyParm)
OR
oMyFormRef=NEWOBJECT('MyFormClassName','MyProcedureFile','',MyParm)
oMyFormRef.Show() [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Focus on the solution....Not the problem.[/sig]
 
There are two ways, Spare:

1) At runtime, create an instance of the class by using the CREATEOBJECT() method, such as this:

[tab][tt]set classlib to MyVCX
[tab]oMyForm = CreateObject(&quot;MyFormClass&quot;)
[/tt]or
[tab][tt]oMyForm = NewObject(&quot;MyFormClass&quot;, &quot;MyVCX&quot;)[/tt]

2) At designtime, create a new form based on your form class:

[tab][tt]create form MyForm as MyFormClas from MyVCX[/tt]
[sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Obviously, Jon, you type faster than I.
So does most of the world, probably, including Orangutans. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Hehe. LOL

Nah...I probably just had a head start. :) [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Focus on the solution....Not the problem.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top