string path = "controlKeyboard.exe"; //将文件存放在bin目录下 //string path = "D:\\controlKeyboard.exe"; //调用非bin目录下的程序路径 ProcessStartInfo startinfo = new ProcessStartInfo(path); startinfo.WindowStyle = ProcessWindowStyle.Normal; Process.Start(startinfo);这段代码可以打开一个打包好的应用程序,如exe文件同样也可以一个文件夹或者一个word文档之类的
string path = "controlKeyboard.exe"; //将文件存放在bin目录下//string path = "D:\\controlKeyboard.exe"; //调用非bin目录下的程序路径ProcessStartInfo startinfo = new ProcessStartInfo(path);startinfo.WindowStyle = ProcessWindowStyle.Normal;Process.Start(startinfo);上面的代码可以打开一个已经打包好的应用程序,如exe后缀的程序
OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "打开(Open)"; ofd.FileName = ""; ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments ofd.Filter = "文本文件(*.txt)|*.txt"; ofd.ValidateNames = true; ofd.CheckFileExists = true; ofd.CheckPathExists = true; try { if (ofd.ShowDialog() == DialogResult.OK) { StreamReader sr = new StreamReader(ofd.FileName, System.Text.Encoding.Default); this.richTextBox1.Text = sr.ReadToEnd(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
结贴给分如果给的不好请别见怪哦,我只是想有劳就有得,嘿嘿...
太感谢各位的帮助了...都回答的这么好,可惜我的分就那么一点点,嘿嘿....谢谢各位的帮忙拉!!