I have a question about Converting from TextBox to Text File. For small files work perfect but for big file it is too slow. I read TextBox line after lines ans then save it to text file. WHat did i do here wrong? I tried with stringbuilder but the result is the same.
My code:
StreamWriter sw = File.CreateText(saveFileDialog2.FileName);
//sw.WriteLine(richTextBox1.Text);
//StringBuilder sw1 = new StringBuilder();
for (int i = 0; i < richTextBox1.Lines.Length; i++)
{
sw.WriteLine(richTextBox1.Lines[i]);
//sw1.AppendLine( richTextBox1.Lines[i]);
}
//sw.Write(sw1.ToString());
sw.Flush();
sw.Close();
You can try:
Or as mentioned in the comments: