none
Is it possible for call the foxpro .prg directly from vb.net? RRS feed

  • Question

  • I tried this code below:

    Module Module1
        Sub Main()
            Dim Fox As New VisualFoxpro.FoxApplication
            Fox.DefaultFilePath = "C:\Temp"
            Fox.DoCmd("Do TestAutomation.prg")
        End Sub
    End Module
    But I don't understand that why the
    VisualFoxpro.FoxApplication
    can't be recognize by the Visual Studio. I tried to
    Imports System.Resources
    Imports System.Runtime

    and still can't work.

    So did I miss out something or it just can't work?



    Friday, June 16, 2017 3:31 PM

All replies

  • Hi

    Have a look at the Process.Start(xxxxx) method. You can, for example start the default application for a file type and load the required data file into it using this method.

    I haven't used FoxPro, but, if it has it5's own file type associated with it, the using the Process.Start("xxxxxxx.yyy) where yyy is the default file type for FoxPro *may* do the trick.


    Regards Les, Livingston, Scotland

    Friday, June 16, 2017 3:41 PM
  • Did you follow the suggestion from the comment on your StackOverFlow question

    https://bytes.com/topic/visual-basic-net/answers/379697-run-program-file-visual-foxpro-using-vb-net


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, June 16, 2017 9:28 PM
    Moderator
  • Yes I have, and after adding the reference, I can run and call the program successfully.
    but i want to ask another question, Can it run standalone after compiled in visual studio without vfp?
    Saturday, June 17, 2017 2:20 AM
  • Yes I have, and after adding the reference, I can run and call the program successfully.
    but i want to ask another question, Can it run standalone after compiled in visual studio without vfp?
    The only way to find out is to try running the app. 

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, June 17, 2017 2:29 AM
    Moderator
  • that means I need  to compile it and put the program in another computer?
    Saturday, June 17, 2017 2:37 AM
  • that means I need  to compile it and put the program in another computer?
    Not necessarily, if the references used are in the bin\Debug folder no, test it on your machine while if after compiling there are no dll files for FP  then yes you need to test it on another PC.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, June 17, 2017 3:08 AM
    Moderator
  • Not necessarily, if the references used are in the bin\Debug folder no, test it on your machine while if after compiling there are no dll files for FP  then yes you need to test it on another PC.

    I test it on other PC, and the results is the module that I call is not working. The reason is the foxpro.exe is not install in that PC so the module can't work. Is there an other method that I can use .prg without installing vfp9?
    Saturday, June 17, 2017 6:01 AM
  • My apologies, I was thinking the code was compiled not a ,prg file.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, June 17, 2017 9:22 AM
    Moderator
  • My apologies, I was thinking the code was compiled not a ,prg file.
    Oh, nvm. Did you mean that the compiled program is .fxp program? Or the program that can run on any computer(.exe)?
    Saturday, June 17, 2017 2:10 PM
  • My apologies, I was thinking the code was compiled not a ,prg file.

    Oh, nvm. Did you mean that the compiled program is .fxp program? Or the program that can run on any computer(.exe)?
    I was thinking you were writing code directly in VB.NET within a Visual Studio project for VB.NET by adding a reference to one or more FP DLL files.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, June 17, 2017 2:21 PM
    Moderator
  • I was thinking you were writing code directly in VB.NET within a Visual Studio project for VB.NET by adding a reference to one or more FP DLL files.

    The only dll is related to foxpro is 'vfpodbc.dll' and 'vfpoledb.dll', and this 2 dll is not to compile the foxpro program to the .exe file.

    EDIT: I found that the vfpodbc.dll can compile the the .prg, but the prerequisites is you need to install vfp9.exe on your computer.

    Saturday, June 17, 2017 2:49 PM
  • I was thinking you were writing code directly in VB.NET within a Visual Studio project for VB.NET by adding a reference to one or more FP DLL files.

    The only dll is related to foxpro is 'vfpodbc.dll' and 'vfpoledb.dll', and this 2 dll is not to compile the foxpro program to the .exe file.

    EDIT: I found that the vfpodbc.dll can compile the the .prg, but the prerequisites is you need to install vfp9.exe on your computer.

    Yes that was why they created .Net which have the runtime in fact inside it. (All programs before those days had always runtimes, even VB6 in native mode). 

    The guys and girls who were developing with Foxpro (it was around 2002) were very sad when they discovered Foxpro was not in it while Foxpro was a major part of Visual Studio 1998.

    Here a link about it in Wikpedia

    https://en.wikipedia.org/wiki/Visual_FoxPro


    Success
    Cor




    Saturday, June 17, 2017 3:48 PM