Reputation: 126
I have an executable in the Solution of which I added, I want to replace the System.Windows.Forms.Application.StartupPath to the executable location. Unfortunately it's continues to navigate to the Bin\debug folder which I don't want, I need to go up an additional level.
string pintoolpath = System.Windows.Forms.Application.StartupPath.Replace(@"\bin\Debug", "").Replace(@"\bin\Release", "");
That's how I'm doing it but it's actually not replacing it at all when printing it to a message box. How would I navigate to say a another folder.
FYI: using the ..\ to navigate up does not currently work as shown below:
string pintoolpath = System.Windows.Forms.Application.StartupPath.Replace(@"..\\bin\Debug", "").Replace(@"..\\bin\Release", "");
Upvotes: 0
Views: 735
Reputation: 126
I have figured out my answer,
The directly path on the Solution Explorer had characters that were different then the actual path. For example the B in Bin was capitalized in the actual path VS the solution explorer having it as a lower case. once changing these I was able to get the correct path by navigating to the appropriate folder.
string pintoolpath = System.Windows.Forms.Application.StartupPath.Replace(@"\Bin\debug", "").Replace(@"\Bin\release", "")
Thanks Rahul for assisting me.
Upvotes: 1