Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reference parent form from child
Message
 
To
14/04/2009 15:35:48
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01394810
Message ID:
01394869
Views:
65
thanks to everyone who posted on this, it really helped
~M

>You have to save the reference in a propriety of the form, otherwise the variable will go out of scope at the end of the Init event.
PARAMETERS oform, mcallnum
>THISFORM.oForm = m.oForm   && You need to create the oForm property first
You then use THISFORM.oForm when you need to reference the parent form.
>
>BTW, referencing a parent form control from another form (specially when it's deeply localised like you case) is rarely a good idea. The day you will rename or move a control in the path, you will break the code and you it may take a while to locate and change all the references. It's far better IMHO to call a method in the parent form that will do the job for the child. For exemple:
*-- In the child form
>THISFORM.oForm.ShowIt()
>
>*-- In the parent ShowIt method
>*-- Tell the control to show itself
HTH
>
>>I have an application where a user clicks on a button and it opens another form, i call the form like this
>>
>>DO FORM nw_insure WITH thisform, mcallnumber
>>
>>on closing the form nw_insure i have to make a field visible on the parent form depending on certain criteria. I wanted to use
>>
>>oform.pgfpageframe1.page3.txt_enterinitials.Visible = .T.
>>
>>but this does not work. On the init of the nw_insure I have
>>
>>PARAMETERS oform, mcallnum
>>
>>so i thought that the oform.... would work. any ideas?
Go raibh maith agat

~M
Previous
Reply
Map
View

Click here to load this message in the networking platform