hi, i want to add a file path to my program.

the file is stored in the folder where my solution is saved!!

how can i code my path in the project so that my path will always be valid?

because at the moment it is e:/..... and when i open my solution on other pc's it doesn't work

thanks

Recommended Answers

All 2 Replies

Using relative pathing is good for that sort of thing. If you don't want it to be relative to the .exe file, then perhaps adding the path to the registry (something all of your friend's pcs should have!) is another good approach. To use a relative path just exclude the drive preamble

eg if a program runs in c:\program\file.exe
doing OpenAFile("testfile") will open c:\program\testfile
and doing OpenAFile("test\testfile.txt") will open c:\program\test\testfile.txt

i have a pdf file and i wish to add it to mey solution in visual studio , and on button click it opens this file. but i don't know how to do it :/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.