How to run a software several times via C# and collect the results?
The software has an interface with several buttons, pressing each button a program being call and ask you to show a data file to be run.
I want to call one of this program, and show it the data file(text file) and run it serveral times and collect the results.
(If you may know a book that may help, please tell me about)
AlanPosted Oct 31, 2008, 5:31 PM
It sounds like you need the System.Diagnostics.Process class to run another application from your C# program.
If the other application is a console application which prints results to the console, then you can redirect the output so your C# program can read it. There's an example in the MSDN link below:
http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput.aspx
If the other application is a GUI application, then (if there's any choice in the matter) it would probably be easiest for it to write its results to a text file which you can then read from your program using a StreamReader. It is possible to read results directly from labels, textboxes and other controls but this is more difficult as you need to call various Win32 API functions.