Can I call a method in a second form?

The place to discuss FoxPro issues not directly related to ProMatrix.

Can I call a method in a second form?

Postby btiguy » Tue Aug 11, 2015 12:32 pm

I know I can create a class for executing a routing, but can I call a method in another form. Form01 calls Form02.MyRoutine()?
TIA
Don
btiguy
 
Posts: 455
Joined: Mon Jun 21, 2010 4:03 pm

Re: Can I call a method in a second form?

Postby ChuckASI » Wed Aug 12, 2015 10:30 am

Don't think you can. I believe Form Methods are like functions within a prg. One program can NOT see the functions in another program UNLESS that program has been declared with a "set procedure" command. I always have a "COMMON" procedure prg in each of my projects where I create functions that will be called from multiple forms or programs.
Chuck Prickett
Associated Systems, Inc.
chuckp@associatedsys.com
ChuckASI
 
Posts: 115
Joined: Mon Jun 14, 2010 9:52 am
Location: Wichita, Ks

Re: Can I call a method in a second form?

Postby Bob » Thu Aug 13, 2015 2:47 pm

Look at the VFP HELP under DO FORM ....

Use the <NAME> LINKED NOSHOW options, then you can execute a method of that form <name>.<methodName>

With the NOSHOW, the form is open but invisible.

You may need to be careful about datasessions and scope ... depending on what the method does.
Bob
 
Posts: 718
Joined: Mon Jun 14, 2010 6:53 am
Location: Near Albany, NY


Return to Visual FoxPro

Who is online

Users browsing this forum: No registered users and 1 guest

cron