From RichTextBox to text files, line after line
I have trouble with saving file from Richtextbox to text file. My richtextbox looks like this; ABC ... SDE ... KLO ... After i saved it looks like this: ABC ... SDE ... KLO ... But i want the same like richtextbox line after lines. What did i do wrong? if (saveFileDialog2.ShowDialog() == DialogResult.OK) { StreamWriter sw = File.CreateText(saveFileDialog2.FileName); sw.WriteLine(richTextBox1.Text); sw.Flush(); sw.Close(); //File.WriteAllText(saveFileDialog2.FileName, str); } You are probably getting this because you are trying to save richTextBox1.Text (the whole text) in one line only using