Solved

Visual Studio 2005 (VB) - Calling FoxPro Program

Posted on 2014-12-12
3
327 Views
Last Modified: 2014-12-15
Hello Experts!
OK so this works fin on my laptop because I have FoxPro installed...but does NOT work on a PC that doesn't have FoxPro installed.

I thought that when I added the reference to FoxPro and it loaded this file (Interop.VisualFoxpro.dll) to my Debug Director as long as that file was present in the application directory on the PC without FoxPro it would use this dll for any and all FoxPro commands.

I'm trying to execute a report from my Visual Basic program and as I mentioned it works fine on my laptop it is when I load (copy) everything down to the PC without FoxPro install it doesn't work...I get Retrieving the COM Class factory for component...etc.

Here is my code:
                Dim FoxPro As New VisualFoxpro.FoxApplication

                FoxPro.DefaultFilePath = sSitePath & "Programs\"
                FoxPro.DoCmd("DO " & sSitePath & "Programs\r_ach_items.prg WITH 'sOutFile & "'

Thanks,
Mark
0
Comment
Question by:smithmrk
3 Comments
 
LVL 80

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 100 total points
ID: 40497589
Did you add the runtime libraries to the client machine that doesn't have vfp installed?
http://msdn.microsoft.com/en-US/library/tz3tcs63(v=vs.80).aspx
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 400 total points
ID: 40498293
The interop is simply a bridge between your application (.NET) and the FoxPro library (COM). It makes the changes and type translations needed for the 2 worlds (.NET and COM) to communicate.

When you reference something that comes from the COM tab, the interop is generated, but the dll that you referenced is not really referenced. And the tools that generate setup programs won't include them in the distribution, to prevent the distribution of files that might be copyrighted. Otherwise, you would simply have to reference Microsoft Excel in one of your application and Word would be automatically installed for any user that uses your application.

You thus have to make sure you have the right to do so, and if so, install these dlls manually, through a script, or add them to whatever you use to distribute your application to your users.

As for the 2 files that are required for FoxPro and listed in the David's link, legally you have the right to redistribute them with your application if you have a valid license for FoxPro.
0
 

Author Closing Comment

by:smithmrk
ID: 40500520
Thanks for the explanation!

I thought that the Interop was a conversion from the COM DLL to the .Net version...didn't realize it was just a way to communicate to the COM DLL.
That just goes to show you how much I know about the COM DLL's in .Net!  I appreciate you taking the time to explain it to me, and I will be registering the FoxPro COM DLL now as we do have a valid license.

Thanks to both of you for helping me through my issue.

Mark
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question