【 解 説 】
ファイルやディレクトリが存在するかを調べるには、System.IO.File.Exists()を使用します。
【 例 文 】
1 2 3 4 5 6 7 8 |
if (System.IO.File.Exists(fileName) == true) { MessageBox.Show(fileName + " exists."); } else { MessageBox.Show(fileName + " does not exist."); } |
■お薦め参考関連資料
Microsoft、Visual Studio、Visual Basic、Visual C#、Windows Vista、Windows Server、SQL Server、Visual C++、Visual Web Developerは、米国 Microsoft Corporationの米国及びその他の国における登録商標または商標です。