PDA

Click to See Complete Forum and Search --> : start another program in c#


session
Jun 21st, 2003, 08:07 PM
how to start another application with c#?

sayclicking the button to start Visual studio .net

thanks for help

DevGrp
Jun 21st, 2003, 08:18 PM
Try this

Process.Start("notepad.exe");

Make sure you have the using System.Diagnostics namespace referenced.
Note: if the program is not in the startup path, you will have to provide the full path to the program.

session
Jun 21st, 2003, 11:20 PM
d'I need the complete path eg. C:\\Program Files\\...
???
Thx for help! :)

DevGrp
Jun 21st, 2003, 11:49 PM
Originally posted by session
d'I need the complete path eg. C:\\Program Files\\...
???
Thx for help! :)
Yes

session
Jun 22nd, 2003, 01:31 AM
ill try it in a bit. thanks! :)

dynamic_sysop
Jun 22nd, 2003, 01:45 PM
in case you are not aware you need to be able to access the Process function in the first place , the easiest way is to put this at the top of your code page : using System.Diagnostics;
eg:

using System.Diagnostics;
//// top of form's code page.
////
public Process processToStart =new Process();

private void button1_Click(object sender, System.EventArgs e)
{
processToStart.StartInfo.FileName="IEXPLORE.exe";
processToStart.StartInfo.Arguments="http://google.com";
processToStart.Start();
}
}

session
Jun 22nd, 2003, 03:07 PM
ok. thanks :)
but...
what do these do:
switch(twinsOnWay)
{
case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way);
break;
}

dynamic_sysop
Jun 22nd, 2003, 05:19 PM
thats my signature , my wife and i are expecting twin babies very soon :)

session
Jun 22nd, 2003, 05:46 PM
awwwwwwwwwww nice! :) I love twins! :D but im only 16 :p