Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Open and close a class library dynamically
Message
 
 
To
10/02/2009 15:27:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 2000 SP4
Network:
Windows NT
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01380668
Message ID:
01380672
Views:
64
Try to add
CLEAR CLASSLIB (thisform.ccflibrary)
>I call the code below from the init method of my form.
>I pass the year.
>Depending on what the year is, I will open a class library for that year.
>
>For example, if the year is 2008, i will open cf2008.vcx.
>If the year is 2007, I will open cf2007.vcx.
>The class name and method is the same in both.
>cf2008.dfprintyearend.printreport
>cf2007.dfprintyearend.printreport
>
>When I initially launch the form, everything works.
>I open the correct library, create a reference to the class I need, and print the report for the year selected.
>
>When I close the form, I remove the reference to the yearly methods and release the library.
>thisform.RemoveObject('oyear')
>RELEASE CLASSLIB (thisform.ccflibrary)
>
>****************************************************************************
>THE PROBLEM
>When I close the form and launch it again, it doesn't work right.
>
>The year is 2008.
>thisform.ccflibrary is cf2008.vcx
>SET CLASSLIB TO (thisform.ccflibrary) ALIAS cf ADDITIVE works.
>
>BUT........
>thisform.AddObject('oyear','dfprintyearend')
>my reference is wrong
>
>oyear
>is pointing to cf2007.dfprintyearend.
>it needs to be pointing to cf2008.dfprintyearend
>
> What am I doing wrong?
>
>Deb
>
>************************************************************************************
>
>PARAMETERS pcyear, llinit
>
>LOCAL lcyear
>
>lcyear = m.pcyear
>
>IF !llinit
> * Remove the reference to the yearly methods.
> thisform.RemoveObject('oyear')
>
> * Release the library.
> RELEASE CLASSLIB (thisform.ccflibrary)
>ENDIF
>
>* Get the name of the yearly library, cf2008.vcx, .vct in c:\codemine\custom.
>thisform.ccflibrary = 'cf' + ALLTRIM(lcyear)
>
>* Open the library.
>SET CLASSLIB TO (thisform.ccflibrary) ALIAS cf ADDITIVE
>
>* Create a reference, oyear, to the year end print methods in dfprintyearend.
>thisform.AddObject('oyear','dfprintyearend')
>
>***********************************************************************************************************
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform