Hi,
I am an old VB6 programmer converting to C#, so I hope you forgive stupid questions.
I am developing a C# app to run on Windows Mobile and Windows CE (handheld terminals). I have figured out how to read data from text files but what is screwing me up is how to tell the program where the text file is on the handheld. Here are some details;
1. In Solution Explorer I created a directory called "Text files"
2. In that directory is a file called "sample.txt"
3. In the properties for sample.txt, under 'Copy to output directory', I chose 'Copy if newer'
So far, so good. When I compile, the text file is copied to a directory under the application directory called 'Text files'.
The problem is when I try to use Streamreader to open the file, it wants to find it at the root directory.
Regardless of where the application is running, I should be able to use a relative path to get to Text files\sample.txt, but it doesn't work that way.
I have this so far;
using (StreamReader sr = new StreamReader("Text files\\sample.txt"))
but it can't find the file. What am I doing wrong? It seems wierd to me that I can't just start in the application directory and path from there.
Scott
How do i tell the application how to find the text file?