(一)具體教程查看:011——C#創建ECXEL文件(附教程)
(二)代碼:foldPath 就是獲取到的文件路徑
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "請選擇文件路徑"; string foldPath = ""; if (dialog.ShowDialog() == DialogResult.OK) { foldPath = dialog.SelectedPath + @"\"; } textBox1.Text = foldPath;
}