>Hi,
>
>Typically - in my VFP9 application - business classes are instantiated in the LOAD of the form. I usually drop the class object on the form - at design time - and the class is instantiated automatically in the LOAD of the form.
>
>Now I need to instantiate an object of a class in code (in a PRG file). So far, the only way I found I could do it is as follows:
>
>
>oObject = NEWOBJECT("class_name","class_name_lib.vcx" )
>
>
>Can you suggest a better way to instantiate the class?
There's a way without the code, but it's tricky. I had to use it when I wanted a bizobject added to a container or page. Namely, I'd add a property which would have this value:
=NEWOBJECT("class_name","class_name_lib.vcx" )
Don't remember whether I had to put all of it except the equal sign in parentheses. This made the object instantiate before any other code in the container or page.
Unless you need this, what you're doing is already the best way.