I'm trying to set a relative path to another project in the same solution. I have a solution with 2 projects (projectA, projectB). The program starts with projectA, on a form of projectA there is a button "proceed to projectB". When clicked a form of projectB is opened. on this form I'm trying to load text files like this:
inputStream = File.OpenText("textfile.txt");
string line = inputStream.ReadLine();
while (line != null)
{
textBox1.AppendText(line);
line = inputStream.ReadLine();
}
The problem here is that I get an FileNotFoundExeption. Since the program looks for textfile.txt in projectA debug folder.
C:\Users\ben\Documents\Project\projectA\bin\Debug
But the textfile is actually located in the projectB debugfolder.
C:\Users\ben\Documents\Project\projectB\bin\Debug
How can I change the path so that the program searches in projectB debug folder?
Thanks in advance.