Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:37:21+00:00 2026-05-28T06:37:21+00:00

In windows phone 7, what is the protocol for updated an isolated storage text

  • 0

In windows phone 7, what is the protocol for updated an isolated storage text file? Say I have 10 words in a text file arranged at 1 per line. Now suppose, the user uses the application and a new word needs to be stored on the fifth line. How do I write to the file, which already contains 10 words with 1 word per line?

Thanks in advance you guys are awesome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:37:21+00:00Added an answer on May 28, 2026 at 6:37 am

    The way I have been doing it is:

    1. Read in a file from IsolatedStorage to menmory
    2. Update the String
    3. Write the file back to storage

    Read in File

    public static string ReadFromStorage(string filename)
    {
        string fileText = "";
        try
        {
            using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (StreamReader sr = new StreamReader(new IsolatedStorageFileStream(filename, FileMode.Open, storage)))
                {
                    fileText = sr.ReadToEnd();
                }
            }
        }
    
        catch
        {
        }
    
        return fileText;
    }
    

    Write to File

    public static void WriteToStorage(string filename, string text)
    {
        try
        {
            using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                string directory = Path.GetDirectoryName(filename);
                if (!storage.DirectoryExists(directory))
                    storage.CreateDirectory(directory);
    
                if (storage.FileExists(filename))
                {
                    MessageBoxResult result = MessageBox.Show(filename + " Exists\nOverwrite Existing File?", "Question", MessageBoxButton.OKCancel);
    
                    if (result == MessageBoxResult.Cancel)
                        return;
                }
    
                using (StreamWriter sw = new StreamWriter(storage.CreateFile(filename)))
                {
                    sw.Write(text);
                }
            }
        }
    
        catch
        {
        }
    }
    

    So I would do:

    string fileName = "Test.txt";
    string testFile = IsolatedStorage_Utility.ReadFromStorage(fileName);
    testFile = testFile.Replace("a", "b");
    IsolatedStorage_Utility.WriteToStorage(fileName, testFile);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Windows Phone application (Silverlight 3) I have a textblock <TextBlock Text={Binding Key} FontSize=40 Foreground={Binding
I have Visual Studio 2008. Do I develop software for Windows phone 7 with
What Windows Phone 7 demo/reference applications have you seen which really made you interested
Does Windows Phone have a limit on the amount of heap memory an app
In Windows Phone (mango) I am using Microsoft.Phone.Controls.Maps. I currently have: var _City =
Some controls in Windows Phone 7 have touchable area around, if you touch not
I am new in windows phone development. Now I am developing a windows phone
Windows Phone 7. I have a ScrollViewer inside a StackPanel inside a PivotItem inside
I have a Windows Phone application I am developing that needs to persist some
I have developed two Windows Phone applications and would like to deploy them on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.