(一)具体教程查看: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;
}