Since Cetin alredy pointed out correct way of handling this issue
via global object holding object references to other forms,
here is quick & dirty :)
public oForm1,oForm2
oForm1=this
and
oForm2=this
After forms are instantiated via regular form calls
do form yourform1.scx
you should be able to access both forms as easy as
oForm1.hide()
oForm2.caption='Form2 Caption'
and so for...
But my real advice is to sooner or later implement
something like Cetin adviced in his messages :)
Rgds++
Sergio
>Good evening all
>
>How do I get a global object reference to a form called by a prg file?
>
>I have a modless form (form1) that is called from a prg via DO FORM form1. Another form (form2)is modal and is called by a menu snipet. Form2 runs some code to change a few properties in Form1. Sounds simple enough, and in fact when running this in my development environment it works fine.
>
>BUT, when running my app, The below code fails.
>
>**form2.mycusmeth()
>form1.backcolor = RGB(255,255,255)
>* fails, error "form1 is not an object"
>
>
>I know that the error is caused by Form1 going out of scope, because it was called from a prg. To remedy, I ran the following in the prg file calling form1.
>
>** prg calling form1
>PUBLIC form1 AS Object
>form1 = .f.
>DO FORM "form1.scx" NAME form1
>
>
>Running the form2.mycusmeth() code still throws the same error, "form1 is not an object".
>
>So, Fox gurus, lend me your genius. How to I obtain and retain an object reference to form1?
>
>Thanks in advance
> -DEL