How to start a program

This question is posted frequently on various forums (I am talking about .NET) and the answer is surprisingly simple (as with most things in .NET).
A lot of people are wondering how to start some program (Word, Excel, Internet Explorer, ...) and how to pass some arguments to it.
So here is a simple C# solution (it should be easy to convert it to VB.NET (just remove the semicolons)):
Process myProcess = new Process ();
myProcess.StartInfo.FileName = "path/to/your/program.exe;
myProcess.StartInfo.Arguments = "some arguments";
myProcess.Start ();
// remove the next line if you don't want to wait
//for the program to exit before continuing
myProcess .WaitForExit ();

Off course there are other attributes that you can apply to the process. You can find all about that here.
Avtor: Anonymous, objavljeno na portalu SloDug.si (Arhiv)

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.