Click here to Skip to main content
12,998,892 members (30,661 online)
Rate this:
Please Sign up or sign in to vote.
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)

Posted 5-May-10 13:22pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You don't. You look up the startup path, it's a property of the Application object.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Thanks very much. Worked like a charm.
It's so easy when you know how !!
Still learning.
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 5 May 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100