Click here to Skip to main content
14,732,983 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need open Pictures folder, which is located in the folder with my project.

That is, at the moment my project is located on the path C:\Users\Zgoly\source\repos\Project\bin\Debug, if I put the folder with the project on the "D" drive, the path becomes "D:\Debug". The program should also find the Pictures folder.

What I have tried:

I tried to do it with "Process.Start" but it didn't work.

The code:
private void bunifuThinButton26_Click_1(object sender, EventArgs e)
{
Process.Start("./Scripts");
}
Posted
Updated 31-Oct-20 3:42am

1 solution

Simple: the Environment.CurrentDirectory Property (System) | Microsoft Docs[^] will tell you where you are, and you just need to use Path.Combine to add the pictures folder to it.

Do be aware that if you are planning on changing images in that folder in your app, it's a poor idea: Where Should I Store My Data?[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900