>I have two forms, form1 and form2 show at the same time with form2 as the active form..
>
>I want to set caption to a button in form1 when form2 is active..
>
>How do I do this?
>
You'll need an object reference. The way how to get it might depend on how the two are related -
One option: By default, Vfp keeps track of running forms in _screen.Forms, so you can loop thru it:
LOCAL loForm as Form
FOR EACH loForm IN _screen.Forms
? loForm.Name
ENDFOR
Inside the loop, you can check if m.loForm is the desired one, perhaps by comparing the loForm.Name if it is unique.
Or use PemStatus() to see whether it has a certain custom method that you created in the Form Designer, e.g. "SetCaption()" or so.
Or another option: you can pass object references directly, instead of scanning _screen.Forms: say form1 runs form2 in a button.Click(). In that case you can do something like:
Do Form form2.SCX With Thisform
.... and in form2.Init() receive the parameter:
LParameters toCallingForm
Thisform.oForm1 = m.toCallingForm
Now you can use the "Thisform.oForm1" reference in any method of form2 or its members.
hth
-Stefan