Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending a Variable from 1 form to another
Message
 
To
16/04/1998 09:16:07
Mark Kessler
U.S.M.C. - Network Operation Center
Quantico, Virginia, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00092475
Message ID:
00092735
Views:
23
>How can I send a variable from one form to another form. Both of the forms are in different files and I can't figure out how to pass a value between the two. Maybe there is some way to have a global variable that both of them can use.

Ed and Carlos had good suggestions. However, you can also pass a variable to the second form:
do form SecondForm with MyVar1, MyVar2
In the INIT method of the second form, you have a PARAMETERS line, which 'receives' the passed parameters and stores them to form properties:
SecondForm.INIT method:

PARAMETERS MyVar1, Myvar2

thisform.icMyVar1 = Myvar1
thisform.icMyVar2 = Myvar2
Please note that the variables Myvar1 and Myvar2 are local to the INIT method. They will go out of scope as soon as the form completes the INIT method. That is the reason for making the form properties and putting the variable information into them. Once this information is in the form property, you can refer to it from any method in the second form.

HTH
Barbara Paltiel, Paltiel Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform