The following code snippet helps you to write a text per a single line.
Note I am assuming that you want to write on a text file.
public static void Main()
{
string path = @"c:\test.txt";
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine("This");
sw.WriteLine("code");
sw.WriteLine("will");
sw.WriteLine("write");
sw.WriteLine("text");
sw.WriteLine("per");
sw.WriteLine("line");
}
}
}
So you can able to write each line each of RichTextBox control as follows
string path = @"c:\test.rtf";
using (StreamWriter sw = File.CreateText(path))
{
foreach (string line in richTextBox1.Lines)
{
sw.WriteLine(line);
}
}