我有代碼以2種不同的形式檢索direcotry路徑。如果在一種形式中,我選擇一個路徑來打開一個文件並處理它,當返回到另一個表單時,我得到一個Direcotry Exception錯誤。我用不同的字符串來獲取路徑爲什麼路徑發生變化
在第二種形式我叫這個:
string strFilePath2;
strFilePath2 = Directory.GetCurrentDirectory();
strFilePath2 = Directory.GetParent(strFilePath2).ToString();
strFilePath2 = Directory.GetParent(strFilePath2).ToString();
strFilePath2 = strFilePath2 + "\\ACH";
在我的第一個形式我叫:
strFilePath = Directory.GetCurrentDirectory();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = strFilePath + "\\ACH\\" + Node;
在調試過程中,我得到的選擇第二種形式的路徑,但不是我期望的路徑。任何人都可以說明原因嗎?
請在問題中加入例外。 – 2010-07-21 08:41:10