010——C#选择文件路径

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

 

posted @ 2019-10-07 16:44  陆小果哥哥  阅读(2130)  评论(0编辑  收藏  举报