I have created a isolated storage that only store one values and display one value of e.g. "aaaaaaaa,aaaaaaaa"
.
How can I make it so that it stores
1)"aaaaaaaa,aaaaaaaaa"
2)"bbbbbbbb,bbbbbbbbb"
3)"cccccccccc,cccccccccc"
Below shows codes that stores only one value:
//get the storage for your app
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
//define a StreamWriter
StreamWriter writeFile;
if (!store.DirectoryExists("SaveFolder"))
{
//Create a directory folder
store.CreateDirectory("SaveFolder");
//Create a new file and use a StreamWriter to the store a new file in
//the directory we just created
writeFile = new StreamWriter(new IsolatedStorageFileStream(
"SaveFolder\\SavedFile.txt",
FileMode.CreateNew,
store));
}
else
{
//Create a new file and use a StreamWriter to the store a new file in
//the directory we just created
writeFile = new StreamWriter(new IsolatedStorageFileStream(
"SaveFolder\\SavedFile.txt",
FileMode.Append,
store));
}
StringWriter str = new StringWriter();
str.Write(textBox1.Text);
str.Write(",");
str.Write(textBox2.Text);
writeFile.WriteLine(str.ToString());
writeFile.Close();
textBox1.Text = string.Empty;
textBox2.Text = string.Empty;
StringWriter str = new StringWriter();
str.Write(textBox1.Text);
str.Write(",");
str.Write(textBox2.Text);
writeFile.WriteLine(str.ToString());
writeFile.Close();
textBox1.Text = string.Empty;
textBox2.Text = string.Empty;
You can use
WriteLine
several times like below