How do you trigger another program or software from an existing C# program?  
Author Message
vannielou





PostPosted: .NET Base Class Library, How do you trigger another program or software from an existing C# program? Top

Hi, i'm very new to C# programming and i was hoping if someone could help me with this problem. I need to trigger a program/software from my existing C# program using a button but i don't really have an idea of how to go out abt doing this. I think that i'll have to look through the directory of the software in order to trigger it from my program. I hope i'm making sense here. Would really appreciate it if someone could provide some feedback.

.NET Development17  
 
 
Mattias Sjogren





PostPosted: .NET Base Class Library, How do you trigger another program or software from an existing C# program? Top

If you know the path to the executable you can just pass it to System.Diagnostics.Process.Start()



 
 
RizwanSharp





PostPosted: .NET Base Class Library, How do you trigger another program or software from an existing C# program? Top

Try this:

System.Diagnostics.Process.Start(completePathOfApplication);

It Works! Cheers ;-)



 
 
vannielou





PostPosted: .NET Base Class Library, How do you trigger another program or software from an existing C# program? Top

 So sorry i have another silly qn to ask. I got this error:

 An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in system.dll

Additional information: The system cannot find the file specified

Do i have to add the reference to my project


 
 
RizwanSharp





PostPosted: .NET Base Class Library, How do you trigger another program or software from an existing C# program? Top

Hey guys, thanks alot! i'll try it out and see if it works. So sorry i have another silly qn to ask. I'm really new to this so plz forgive me! What do i put in the brackets Is it the directory/path of application i want to trigger

Yes Complete path of application to run!

System.Diagnostics.Process.Start("C:\\myapp.exe");

Cheers ;-)