c# - How do I open a specific file in a folder same level as solution? -
i looking help. have created application, , 1 of buttons meant open specific file.
i have put specified .txt document folder on program. on same level "solution" file. now, how go writing code open specific .txt file?
i started out with: streamreader reader; // class-level reader = new streamreader("../textfilehere.txt");
but, keep getting error message. unhandled exception of type 'system.io.directorynotfoundexception' occurred in mscorlib.dll
what mean & doing wrong? can move file, if make easier.
with reader = new streamreader("textfilehere.txt")
face problems if put shortcut of application somewhere else desktop. in order appliaction working no matter address is, have this:
reader = new streamreader(application.startuppath + "\\textfilehere.txt")
Comments
Post a Comment