Wriju's BLOG

.NET, Cloud and everything

Windows Phone Storing string in Application Setting

For small key-value pair like storage we can use Application Setting and store the string. It is simple and easy to retrieve.

// Storing the data in Application Settings
private void btnSave_Click(object sender, RoutedEventArgs e)
    IsolatedStorageSettings.ApplicationSettings["TheName"] = txtName.Text;
    IsolatedStorageSettings.ApplicationSettings.Save(); //Important to call to Save it

//Getting the data from Application Settings
private void btnRead_Click(object sender, RoutedEventArgs e)
        txtRead.Text = (string)IsolatedStorageSettings.ApplicationSettings["TheName"];

        //To remove