从OpenFileDialog c#中选择它后启动进程 [英] Start process after select it from OpenFileDialog c#
问题描述
嘿
我想知道.
从OpenFileDialog中选择它后如何启动过程
Hey
I want to know .
How to start process after select it from OpenFileDialog
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "XXXXXXXXXXX";
ofd.Filter = "xxxxxxxxxxxx|xxxxxx";
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.textBox1.Text = ofd.FileName;
}
它应该将Ive选择的文件的行路径放入textbox1
现在,我要创建一个按钮以启动我从openfiledialog中选择的项目.
例如:
浏览.->选定的firefox.exe
名为开始"的按钮以启动我选择的firefox.exe
有人可以帮助我吗?
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?
推荐答案
请使用
Process.start(Firefox.exe);
正如Dominic所说的,您应该使用Process.Start
方法.
您可以对按钮单击事件进行编码,例如:
As Dominic said you shouldProcess.Start
method.
You can code to your button click event such as:
Process.Start(textbox1.Text);
以下是一些适合您的详细链接:
MSDN Process.Start方法 [ ^ ]
如何使用此方法的示例 [ ^ ]
祝你好运,
OI
Here are some detailed links for you:
MSDN Process.Start Method[^]
Examples of how you can use this method[^]
Good luck,
OI
这篇关于从OpenFileDialog c#中选择它后启动进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!