1、引入using System.IO;
2、写代码Directory.Exists(路径)返回的是bool值, true 或 false ,
3、验证一下, 新建一个工程, 添加一个textbox , 一个button在button事件中写代码 if (System.IO.Directory.Ex足毂忍珩ists(textBox_保存目录.Text) == false) { MessageBox.Show("保存路径不存在!"); return; }
时间:2024-10-12 04:33:28
1、引入using System.IO;
2、写代码Directory.Exists(路径)返回的是bool值, true 或 false ,
3、验证一下, 新建一个工程, 添加一个textbox , 一个button在button事件中写代码 if (System.IO.Directory.Ex足毂忍珩ists(textBox_保存目录.Text) == false) { MessageBox.Show("保存路径不存在!"); return; }