Reputation: 1072
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = openFileDialog1.FileName;
ProcessStartInfo info = new ProcessStartInfo();
info.WindowStyle = ProcessWindowStyle.Hidden;
info.FileName = "WK01.exe";
info.Arguments = "WK01.exe";
info.Arguments = fileName;
Process p = new Process();
p.StartInfo = info;
p.Start();
p.WaitForExit();
}
}
When I run this code , this code break on p.Start();
, as my WK01.exe project contain 2 arguments , one is its path and second is what I give to it like picture or anything , when I run it and press the button it ask me for picking the file when I pick the file it break program on p.Start();
Upvotes: 0
Views: 155
Reputation: 4779
That's because there is no wk01.exe executable file in your bin/debug (or bin/release) folder.
If you want, you can add it to your project files (even as a reference) and mark as "Copy to Output directory = Copy always" to do that automatically.
Upvotes: 1