Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling a Form while in a different form.

Status
Not open for further replies.

bebbo

Programmer
Dec 5, 2000
621
GB
I wish to change a setting on a form while pressing buttons on a different form. How do I do this. Ie If I press command1 on form1 how do I refresh form2?

Thanks
 
If you opened Form2 from within Form1 using the DO FORM command, you can use the LINKED keyword to create an object reference to it. You can then control Form2 from within Form1 using that object reference.

Another solution is to use a Formset and place both forms in the Formset. They have a common parent that way and can reference each other.
 
You can also reference the first form by name. Say it is named Form2. In Form1, in the Click event of the Command button:

Form2.Refresh()
or
Form2.TextBox1.Refresh()

And so on.

Dave S.
 
I use this approach while handling calls between multiple forms.

public oformObj

DO FORM myForm Name oformObj

Now you can make changes to myForm through oformObj.
eg. oformObj.cmd1.click()

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top