I need some help on calling foxprogram from c# code.
We have dedicated machine where we have fox releated program.
Machine Name : TestFox
We have shared folder \\TestFox\FoxPrograms
I need to call init.prg which is present in \\TestFox\FoxPrograms [It is built in vfp9]
I used the below code
try
{
string foxCommand = "init.prg";
var parse = new FoxApplication();
parse.DefaultFilePath = @"\\TestFox\FoxPrograms";
parse.DoCmd(foxCommand);
}
catch (Exception ex)
{
//I m getting exception
//{System.Runtime.InteropServices.COMException (0x80020009):
//Exception occurred. (Exception from HRESULT:
//0x80020009 (DISP_E_EXCEPTION)) at VisualFoxpro.Application.DoCmd
//(String bstrCmd)
//at CallFox.Program.CallFoxPraser(String step)
//in C :\Users\ssnagendrakumar\documents\
//visual studio 2010\Projects\CallFox\CallFox\Program.cs:line 32}
}
I refered vfp9.exe in solution to get FoxApplication()
Can someone help me? please
I believe you need to use the VisualFoxpro.FoxApplication
class, and you are passing invalid syntax - to execute a VFP program you need to use the DO
command:
var parse = new VisualFoxpro.FoxApplication;
string foxCommand = "do init.prg";
parse.DefaultFilePath = @"\\TestFox\FoxPrograms";
parse.DoCmd(foxCommand);
User contributions licensed under CC BY-SA 3.0