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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -