Click here to Skip to main content
11,802,442 members (70,944 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB8.0 VB
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 at 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
0 OriginalGriff 465
1 KrunalRohit 366
2 F-ES Sitecore 295
3 Sergey Alexandrovich Kryukov 241
4 Afzaal Ahmad Zeeshan 230
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,645
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web01 | 2.8.151002.1 | Last Updated 5 May 2010
Copyright © CodeProject, 1999-2015
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