Interview Question in Visual Studio 2005
Interview Question :: Application.StartupPath (VB--Visual Studio 2005) |
I have a program (my first where I made up all the code instead of copying it out of a learn-to-program book!) that needs to use a .txt file as input. I've been using the line:
FileOpen(1, "C:\Folder Name\FileName.txt", OpenMode.Input)
but I wanted to change the hard coded path to use Application.StartupPath instead so that if people put it somewhere other than the C drive it would still work. So I used the line:
FileOpen(1, Application.StartupPath & "\Folder Name\FileName.txt", OpenMode.Input)
but then my code wouldn't debug properly.
I get an error message when I try to debug that says:
Could not find a part of the path 'C:\Folder Name\Folder Name\Folder Name\bin\Release\Folder Name\FileName.txt'.
What am I doing wrong?
Thanks! |
|
|
|

Loading ...