Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Ken Murphy
 To: roro roro
  Where is roro roro?
 roro roro
Subject: RE: forms
Thread ID: 104144 Message ID: 104147 # Views: 1 # Ratings: 0
Version: Visual FoxPro 8 Category: Forms
Date: Saturday, August 12, 2006 2:11:18 AM         

> Hi,
> I want to change a textbox value in form1 by clicking a button in form2
> but form2 doesnt see form1 so how can i do that????
> thx

As Vince told you, a Public variable would be visible to both forms. On the other hand, that public variable would also be visible to any other form. The more forms or procedures that can see that variable, the more risk that those forms could modify the value in that variable. I do NOT like public variables. A better way to go is with a private variable. When you call your forms, you can
pcMyVar = [Some Value]
DO MyForm1 WITH MyVar
DO MyForm2 WITH MyVar

And in the .Init of each form,
ThisForm.cMyVar = pcMyVar && store it in a custom form property.

If you call one form from the other, you can actually send a reference of the first form to the other.
DO MySecondForm WITH ThisForm
* and in your second form's .Init()
ThisForm.oCallingForm = loCallingForm && ThisForm.oCallingForm is a custom form property.

Now you can do things like
ThisForm.OCallingForm.Container1.TextBox1.Value = This.Value
and you will have just placed This.Value into a textbox on the other form.

Play with it and you will see.

You shall know the truth - and the truth shall set you free. (John 8:33)


forms Posted by roro roro @ 8/11/2006 10:12:04 PM
RE: forms Posted by Vincent Byrne @ 8/11/2006 10:19:21 PM
RE: forms Posted by Ken Murphy @ 8/12/2006 2:11:18 AM
RE: forms Posted by Christian Pano @ 8/12/2006 4:18:54 AM
RE: forms Posted by Marcia Akins @ 8/12/2006 3:36:42 PM