Reputation: 897
IsolatedStorageFile iF = IsolatedStorageFile.GetUserStoreForApplication();
if (!iF.DirectoryExists("aaa"))
{
MessageBox.Show("No directory, create!");
iF.CreateDirectory("aaa");
}
StreamWriter fW = new StreamWriter(new IsolatedStorageFileStream("girls\\list.txt", FileMode.OpenOrCreate, iF));
fW.WriteLine(this.tb_name.Text);
So, I create file, or open it, and add to it content of textbox. I need append this file, but it rewrites. Please, help me to solve this problem :) Thank you!
Upvotes: 0
Views: 384
Reputation: 93561
You want FileMode.Append
, not FileMode.OpenOrCreate
See this page for details http://msdn.microsoft.com/en-us/library/system.io.filemode(v=vs.95).aspx
Append: Opens the file if it exists and seeks to the end of the file, or creates a new file.
Upvotes: 2
Reputation: 20157
Use FileMode.Append
for if it exists, FileMode.Create
if it does not.
Upvotes: 1