【1】FolderBrowserDialog:用來選擇一個文件夾,從而讀取這個文件夾下面的全部文件spa
【2】OpenFileDialog: 用來讀取單個文件io
//文件選擇
OpenFileDialog op = new OpenFileDialog();
op.Filter = "word Files(*.doc)|*.doc|All Files(*.*)|*.*";
if (op.ShowDialog() == DialogResult.OK)
{
textBox2.Text = op.FileName;
}
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
//文件路徑選擇
textBox1.Text = folderBrowserDialog1.SelectedPath;程序
//執行程序路徑選擇
textBox3.Text = Application.StartupPath;
}word