Solved

Visual Studio 2005 (VB) - Calling FoxPro Program

Posted on 2014-12-12
3
322 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 78

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now