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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms from one project in another

Status
Not open for further replies.

Ed Andres

IS-IT--Management
Mar 27, 2001
142
US
Can I have forms from one project used in another project? I have two stand alone apps. I'd like to be able to call the forms of one app from the other app. Seems like there would be path issues but I haven't been able to try it out yet. Just thouhgt I'd check to see if anyone has tried this before. These apps are used internally so I have total control of the install and how they connect to our data source.

What do you think?

Ed
 
Ed,
Yes, this does work. Just know if you make a change to it, you'll want to recompile your other project too to make it work.
-S



Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 

Ed,

Whether or not a form is in a given project does not affect how you use that form. The project is just a tool in the development environment. Commands like DO FORM don't know anything about it.

What's more important is what happens at build time. When you build an EXE, VFP has to know which forms to include. If the form isn't in the project you are building, VFP will try to find it and add it to the project. But if VFP doesn't see the form name during the build (for example, if you macro-execute the DO FORM), it won't build it into the EXE and you'll eventually get a run time error.

The solution to that is quite simple: Put the form in both projects. There's no problem in doing that. You're not creating a copy of the form, so any changes you make in one project will automatically apply in other.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks for the knowledge.
This brings up the next question, What is the best way to call the form?

I am currently using something like this:
DO FORM ..\appPath\forms\myform.scx

Sorry for these seemly basic questions but I have never had to develop an app that wasn't used internally so I never had to worry about paths and issues like that.

Ed
 

It's best not to hard-code the directory path into the DO FORM command -- even relative directories.

The best approach is as follows. In your development environment, set up your search path to contain a list of all the directories you use for your forms, reports, menus, PRGs etc. You can do this by executing a SET PATH in your main program, or by going to Tools / Options / File Locations / Search Path ... Set As Default.

Then, omit the path from the DO FORM. Just supply the actual form name.

When you build that app, the form will get bound into the EXE, so VFP will always find it at run time.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,
I'll give it a try - thanks for your help.

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top