Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reference one form from another
Message
 
 
To
17/07/2000 23:07:31
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00393630
Message ID:
00393639
Views:
12
>>>How do I reference a control on another form from the current form? i.e. Thisform.controlname.value would be the value of a control on the current form. How do you say Theotherform.controlname.value?
>>>
>>>Thanks
>>>JD
>>
>>Loop through the _Screen.Forms[] collection for the other form (you can check the name property) and when found use it.
>
>What is the _Screen.Forms[] collection?

Whenever you issue a DO FORM command or CREATEOBJECT('form'), an object reference to your form is added to a property of _Screen called Forms. This is an array property that has references to all active forms.

To loop through it:
lparameter tcformname
local luretval
luretval = .NULL.
for lxx = 1 to _Screen.Formcount
   if upper(_Screen.Forms[lxx].BaseClass) = "FORM" ;  && could be a toolbar
      and upper(_Screen.Forms[lxx].Name) = upper(tcformname) then
      luretval = _Screen.Forms[lxx]
      exit
   endif
endfor
return luretval
Check the return value with ISNULL() and if it isn't, then you now have an object reference to your other form.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform