Quantcast
Viewing all articles
Browse latest Browse all 29128

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 Settingsprivatevoid 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 Settingsprivatevoid btnRead_Click(object sender, RoutedEventArgs e)
{
    if(IsolatedStorageSettings.ApplicationSettings.Contains("TheName"))
    {
        txtRead.Text = (string)IsolatedStorageSettings.ApplicationSettings["TheName"];

        //To remove IsolatedStorageSettings.ApplicationSettings.Remove("TheName");
    }            
}

Namoskar!!!

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 29128

Trending Articles