C# 判斷路徑是否合法

Using System.IO;

//
判斷文件路徑是否合法
if (File.Exists(txtAttachment.Text.ToString())==false)
 {
    FrontHelper.ShowMsg(
2"文件不存在"); 
}
//判斷文件夾路徑是否合會
 if (Directory.Exists(txtFilePath.Text))
 {             
     this.Close();
}
else
 {
    // \:為轉義字符
    FrontHelper.ShowMsg(2"\"常用文件夾存放路徑\"存放不正確");
 }

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2021-12-04
  • 2021-12-26
  • 2022-12-23
  • 2021-12-26
  • 2021-07-02
  • 2022-12-23
猜你喜欢
  • 2022-01-21
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-08-20
  • 2022-12-23
相关资源
相似解决方案