Any Windows Phone 7 Devs out there?

CrazYmonkeY159

Expert Member
Joined
Sep 13, 2007
Messages
2,142
Reaction score
0
Location
CPT/PE
Hi guys

I have a simple yet confusing problem.

I have a file which ive added to my project called 'names.txt' which is a list of names

I want to read that file in my app using normal C# methods but no success

ive tried IsolatedFileStorage and im getting nowhere :(
 
I came as soon as I saw the bat signal!

Click on the file and set the Build Action in properties to "Resource", then load it like this:
using (StreamReader reader = new StreamReader(Application.GetResourceStream(new Uri("/YourProjectName;component/filename.txt", UriKind.Relative)).Stream))
{
string text = reader.ReadToEnd();
}
Obviously edit YourProjectName and filename.txt.

That should work, but I haven't tried it, let me know if it doesn't.
 
Top
Sign up to the MyBroadband newsletter
X