Come out of folder when using StartupPath.

Posted by Sathya4260 under Windows Forms category on | Points: 40 | Views : 3163

Here the code to come out of the application folder when we using StartupPath.

Usually we woud be using the below code to retrieve the application path, which would be defaultly inside the bin\bebug folder,
so we would need to come out of the folder and access our data's

string path= new DirectoryInfo(Application.StartupPath);

so to come out of one folder use the below code

string exeFolder = new DirectoryInfo(Application.StartupPath).Parent.FullName;

to come out of two folder use the below code

string exeFolder = new DirectoryInfo(Application.StartupPath).Parent.Parent.FullName;

If this helped kindly put your comments on this...

Comments or Responses

Posted by: Patelriki13 on: 9/7/2011 Level:Starter | Status: [Member] | Points: 10
thank you very much..nice article

Login to post response