Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing values to another form.
Message
 
To
22/07/1998 03:47:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00119709
Message ID:
00120080
Views:
23
>>>>>>I have form that has a text box bound to a table. I need to pass the value in the text box to another form. How do I do that and what would the code look like?
>>>>>>
>>>>>>Thanks, Brad.
>>>>>
>>>>>If you are creating the new form, then it's not such a problem
>>>>>
>>>>>Use
>>>>>
>>>>>DO FORM formname WITH THISFORM.Textbox.Value
>>>>>or
>>>>>loForm = CreateObject( "formclass", THISFORM.Textbox.Value)
>>>>>
>>>>>and then pick up the passed value by using a PARAMETERS statement in the Init of the Form.
>>>>
>>>>Mark,
>>>>
>>>>Thanks for responding to my question. What should the init code on the form look like with the parameters?
>>>>
>>>>I am using on the main form DO FORM c:\b3\magnify.scx with thisform.text1.value
>>>>
>>>>I put LPARAMETER cString in the init of the second form. Does it automatically asign the passed variable to the parameter?
>>>>
>>>>Thanks again,
>>>>Brad.
>>>I think Mark is not here so I can answer. Yes Brad cString would be assigned the value you passed. But beware that parameter(s) are scoped to init method. You either save it in a form property or use just in init. ie: if you use it in something like :
>>>
set filter to myField = cString
You would face an error message. Instead use "name" clause of form I suggest.
>>>
do form myCaller name ("myForm") linked
>>>*From within myCaller any method
>>>DO FORM c:\b3\magnify.scx
>>>* Now magnify.scx could access myCaller's text1.value via myForm
>>>* or any PEM of myCaller
>>>* Magnify.scx any method, event
>>>if myForm.text1.value = ...
>>>....
>>>* Or change a prop in myCaller
>>>myForm.text1.backcolor = rgb(255,255,128)
>>>*Or refresh myCaller
>>>myForm.refresh
Cetin
>>
>>Thank you very much for answering my quesions.
>>
>>I am getting an error "NO Parameter Statement is found" however, I have put Lparameter cText1 in the init of the new form. Any suggestions?
>>
>>Thanks in advance,
>>Brad
>Brad,
>Possibilities I can think :
>-lparameters (or parameters) is not the first line in init.
>-Windowtype property is 2 or 3 (only FP 2.x converted could be) so parameter is passed to load event not init.
>
>But in all I still insist using "name" clause in "do form" is better. You'll realize it's, when you try to return value(s) from a form or need to access another form.
>Cetin

You might also keep in mind the scope of "name". If you want to access mothods and properties of "name" it must be PUBLIC in many circumstances.

Eric K.
Previous
Reply
Map
View

Click here to load this message in the networking platform