Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hye,
i am working in windows mobile 7
I have added a file "Book.txt" in my project.
and i want to read it using the code -

using (StreamReader reader = new StreamReader("Book.txt"))
            {
                string content = reader.ReadLine();
                string[] str = content.Split(",".ToCharArray());
                
                Book newB = new Book();

                newB.bookId = int.Parse(str[0]);
                newB.volumeId = int.Parse(str[1]);

                return newB
            }


but it gives error -

attempt to access the method failed system.io.streamreader..ctor system.string

at the line -

using (StreamReader reader = new StreamReader("Book.txt"))


what should i do now.....

thanks in advance....
Posted

1 solution

Windows Phone 7 is sandboxed, thus, you can not do IO like Desktop. Look at IsolatedStorageFile.GetUserStoreForApplication()

Here is a good example on this blog[^]
 
Share this answer
 
Comments
DeepsMann 24-Jan-11 2:13am    
hye Yusuf
I have used isolatedstorage as well...
but then also it doesn't work...

thanks for ur reply

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900