Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing Params in Form Classes
Message
 
To
17/04/2007 08:58:22
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01216407
Message ID:
01216682
Views:
21
>Hi Tommy.
>
>>>The most general solution is to pass FormA to FormB, eg. Thisform.oFormB=createobject("FormB",Thisform). Now both forms know of each other and can work together.
>
>The easiest way to accomplish the general case of FormA calling FormB to perform some task and returning a value back to FormA is:
>
>- Make FormB modal or call its Show method as Show(1) so it runs as a modal form.
>
>- There's no need to store a reference to FormB in a FormA property; since FormB is called modally, the FormA method calling FormB doesn't terminate until FormB closes, so using a variable to hold the reference is fine.
>
>- In FormB, have an OK button with code like this in its Click method:
>
>
Thisform.SomeProperty = TheReturnValue
>Thisform.Hide()
>
>Have a Cancel button with Thisform.Release() in its Click method. If the user clicks Cancel, FormB is released. If the user clicks OK, FormB is hidden and control returns to FormA, which can then check FormB.SomeProperty for the return value. Example code in FormA:
>
>
loForm = createobject('FormB')
>loForm.Show(1)
>if vartype(loForm) = 'O'
>  lcReturn = loForm.SomeProperty
>else
>* user cancelled FormB
>endif
>
>Doug

Good stuff! Thanks!!
Tommy Tillman A+ NetWork+ MCP
Previous
Reply
Map
View

Click here to load this message in the networking platform