Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The application I'm developing populates list boxes by reading a text file at the form load event. At the moment I have the file located in C:\ and that's the path in my program.
When I build the project I would like the text file to be in the same folder as the app (or a sub folder), so how do I make the path relative?

ie FileReader = New StreamReader(Relative Path)

Paul
Posted

You don't. You look up the startup path, it's a property of the Application object.
 
Share this answer
 
Thanks very much. Worked like a charm.
It's so easy when you know how !!
Still learning.
 
Share this answer
 
Comments
Christian Graus 5-May-10 20:19pm    
No problems. You should use the Add Comment link to add comments, rather than push answer when what you're posting is not an answer. But, I do appreciate you thanking me, not many people do. You should also mark my comment as being the correct answer, so that the search system can optimise to use the data we've provided. If you feel inclined, you can also vote my answer a 5, but that's up to you. Either way, you're welcome :-)

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