HI WELCOME TO KANSIRIS

How to set file path to a file in project folder

Leave a Comment

 Take a look at System.IO.Path[^] class, it performs operations on string instances that contain file or directory path information.


To read/write a file, that is located where your program runs, you can uses something like this:
string fileToRead = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\MyOtherFile.xml";

string allDataFromFile = System.IO.File.ReadAllText(fileToRead);

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.