Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey
I want to know .
How to start process after select it from OpenFileDialog

C#
OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = "XXXXXXXXXXX";
            ofd.Filter = "xxxxxxxxxxxx|xxxxxx";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.textBox1.Text = ofd.FileName;
            }


It should put the line path of the file Ive selected to textbox1
Now , I want to make a button to launch that item I;ve selected from openfiledialog.
For example:
browse.. -> selected firefox.exe
button named 'Start' to start firefox.exe that I've selected


can anyone help me?
Posted

As Dominic said you should Process.Start method.

You can code to your button click event such as:
C#
Process.Start(textbox1.Text);


Here are some detailed links for you:
MSDN Process.Start Method[^]
Examples of how you can use this method[^]

Good luck,

OI
 
Share this answer
 
Please use
C#
Process.start(Firefox.exe);
 
Share this answer
 
v2
Comments
Dominic Abraham 19-Nov-12 21:08pm    
If the solution is helpful for you, don't forget to mark it as answer. Then it will be helpful for others also.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900