If it is stored inside a folder in the same directory as the EXE then you need to get the StartUpPath using the Application class. The StartupPath will provide you with the absolute path to where the EXE is stored.
Dim reader As New StreamReader(Application.StartupPath & "\saved\file.txt")
Application.StartupPath is a variable that allows you to get the directory of where the application is running from -- Unlike the Current Working Directory, which is changed at semi-random (ie your user opens a file with the Open File Dialog box). This doesnt change but its the initial path.
Use Application.Info.DirectoryPath for the location of the assembly :3
Edit: Always in your code assume you're in a production environment unless there is a SPECIFIC reason not to.
This post has been edited by indrora: 26 August 2008 - 08:18 PM
so i can use that code for the final project but what should i use for when its in development?
like im still coding it?
It will be the same for development as when testing. It always gets the current location of the EXE, regardless of where it is stored on the hard drive, with one exception.
If you use ClickOnce for deployment of your application then you need to use the following. In addition, you must deploy the application with Full Trust in order for it to work. See the following links for more information.
Dim reader As New StreamReader(ApplicationDeployment.CurrentDeployment.DataDirectory & "\saved\file.txt")