Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pass Value back from Instantiated CreateObject
Message
 
À
22/10/2007 05:14:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01262171
Message ID:
01262601
Vues:
11
Excellent idea!

I will try that approach too.

Many thanks!


>>Hey Gang!
>>
>>In my code, I have one form creating another form with the code below....
>>
>>*****************************************************************
>>
>>CASE tnModule = 2
>>	Thisform.p_module = CREATEOBJECT("frmDoctorDefault",RECNO("nh_facility"),1)
>>
>>*****************************************************************
>>
>>Thisform.p_module is the property of the First Form ("Facility") that is the object reference to the second form ("frmDoctorDefault").
>>
>>I want to be able to pass back to the first form ("Facility") the doctor_id found in the second form.
>>
>>The frmDoctorDefault form has a grid in it, that has as its datasource the Doctor table. The user can browse the table and select the doctor manually. So, at this point, the user is looking and has selected the doctor.
>>
>>Other than a global variable (yuk!), or a global property, how can I pass this info back to the calling form?
>>
>>Thanks!!!
>
>
>Pass object reference of first form to second form and then store it in some property of second form.
>
>
>Instead of
>
>Thisform.p_module = CREATEOBJECT("frmDoctorDefault",RECNO("nh_facility"),1)
>
>
>You could do
>
>Thisform.p_module = CREATEOBJECT("frmDoctorDefault",RECNO("nh_facility"),1,thisform)
>
>&&while in called form init you would put additional paramater to receive
>&&object reference of caller form and store it for later use.
>
>** Init method of second form
>lparameters p1,p2,p3, oCallerForm
>this.oCaller=oCallerForm &&Property added to store that ref. for later use.
>
>
>
>
>
>After that you can easily access things both ways.
>No need to return any values.
>
>Just make sure you properly release forms so no dangling references occur.
>
>HTH
Tommy Tillman A+ NetWork+ MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform