我想从指定的文件路径运行程序。 当您单击图片时,它将运行textBox1中的路径。 textBox1从openFileDialog获取数据。
当用户选择文件路径时,我希望他们能够单击图片,它将运行文本框中指定的路径。
private void pictureBox17_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"INSERT PATH FROM TEXTBOX HERE");
}
private void button9_Click(object sender, EventArgs e)
{
textBox1.Clear();
openFileDialog1.ValidateNames = false;
openFileDialog1.CheckFileExists = true;
openFileDialog1.CheckPathExists = true;
openFileDialog1.FileName = "program.exe";
openFileDialog1.ShowDialog();
textBox1.Text = System.IO.Path.GetFullPath(openFileDialog1.FileName);
}