By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,706 Members | 1,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,706 IT Pros & Developers. It's quick & easy.

Run a program file in Visual Foxpro using VB.NET

P: n/a
I have a abc.PRG file in visual foxpro 8.0. I can run this file using visual
foxpro environment and it creates a table X.dbf in the same folder where this
program file is and populates some data in the table.
I want a way to run this abc.PRG file through VB.net environment.
(Equivalent method to perform same as "DO abc.prg" command in foxpro).
Please help me. Thanks in advance.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Amar,

If you can figure out the string that runs the program - eg,
"c:\fox\foxpro.exe abc.prg" - then you can call it like this:

Dim psi As New ProcessStartInfo

psi.UseShellExecute = True

psi.FileName = "c:\fox\foxpro.exe abc.prg"

Process.Start(psi)

But bear in mind that this is using the services of foxpro to run the .prg
file - and I don't think there is any way you can avoid this - in other
words, you would have to install foxpro on any machine that runs this prg
file.

HTH,

Bernie Yaeger

"Amar" <Am**@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
I have a abc.PRG file in visual foxpro 8.0. I can run this file using
visual
foxpro environment and it creates a table X.dbf in the same folder where
this
program file is and populates some data in the table.
I want a way to run this abc.PRG file through VB.net environment.
(Equivalent method to perform same as "DO abc.prg" command in foxpro).
Please help me. Thanks in advance.

Nov 21 '05 #2

P: n/a
Hi Amar,

Here's another way, and as Bernie said, this assumes VFP is installed on the
machine. Otherwise you'll need a VFP exe and the appropriate runtimes
installed.

'-- Add a reference to the Visual FoxPro Type Library
'-- I'm using VFP 9 so the reference points to
'-- C:\Program Files\Microsoft Visual FoxPro 9\VFP9.exe
'-- Assume program TestAutomation.prg in C:\Temp

Module Module1
Sub Main()
'-- Intellisense with bring up the VFP properties and methods
Dim Fox As New VisualFoxpro.FoxApplication
Fox.DefaultFilePath = "C:\Temp"
Fox.DoCmd("Do TestAutomation.prg")
End Sub
End Module

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Amar" <Am**@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
I have a abc.PRG file in visual foxpro 8.0. I can run this file using
visual
foxpro environment and it creates a table X.dbf in the same folder where
this
program file is and populates some data in the table.
I want a way to run this abc.PRG file through VB.net environment.
(Equivalent method to perform same as "DO abc.prg" command in foxpro).
Please help me. Thanks in advance.

Nov 21 '05 #3

P: n/a
Thank you Cindy. You are my hero!!
Bernie thank you so much too. Both of your are awesome. Thanks again!!

"Cindy Winegarden" wrote:
Hi Amar,

Here's another way, and as Bernie said, this assumes VFP is installed on the
machine. Otherwise you'll need a VFP exe and the appropriate runtimes
installed.

'-- Add a reference to the Visual FoxPro Type Library
'-- I'm using VFP 9 so the reference points to
'-- C:\Program Files\Microsoft Visual FoxPro 9\VFP9.exe
'-- Assume program TestAutomation.prg in C:\Temp

Module Module1
Sub Main()
'-- Intellisense with bring up the VFP properties and methods
Dim Fox As New VisualFoxpro.FoxApplication
Fox.DefaultFilePath = "C:\Temp"
Fox.DoCmd("Do TestAutomation.prg")
End Sub
End Module

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Amar" <Am**@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
I have a abc.PRG file in visual foxpro 8.0. I can run this file using
visual
foxpro environment and it creates a table X.dbf in the same folder where
this
program file is and populates some data in the table.
I want a way to run this abc.PRG file through VB.net environment.
(Equivalent method to perform same as "DO abc.prg" command in foxpro).
Please help me. Thanks in advance.


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.