2
Answers

Why the path is getting changed

Chaitanya

Chaitanya

13y
1.4k
1

Hi all. I have code which retrieves a direcotry path in 2 different forms. If, in one form, I select a path to open a file and process it, when returning to the other form I am getting a Direcotry Exception error. I used to different strings to get that path

In the second form I called this:

       string strFilePath2;
       strFilePath2
= Directory.GetCurrentDirectory();
       strFilePath2
= Directory.GetParent(strFilePath2).ToString();
       strFilePath2
= Directory.GetParent(strFilePath2).ToString();
       strFilePath2
= strFilePath2 + "\\ACH";

In my first form I called:

       strFilePath = Directory.GetCurrentDirectory();
       strFilePath
= Directory.GetParent(strFilePath).ToString();
       strFilePath
= Directory.GetParent(strFilePath).ToString();
       strFilePath
= strFilePath + "\\ACH\\" + Node;

During debugging, I am getting the selected path from the second form, but not the path I expected. Can any one tell why?

Answers (2)