>>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.
First, thank you for your message.
I need this class instantiated in the Main.prg. So, as far as I know, there is nothing to add this class to.
I suppose - unless someone suggest a better than mine approach - I will keep it in code, as I indicated in the initial post.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham