我有代码以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