im creating a program similar to Notepad++ but I have run in to a problem, when I save a file it puts all text in one line, like this:
Test Line 1Test Line 2Test Line 3
Instead of:
Test Line 1
Test Line 2
Test Line 3
Here is the code I use to save:
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
String filename = saveFileDialog1.FileName;
if (filename != "")
{
File.WriteAllText(filename, "");
StreamWriter strw = new StreamWriter(filename);
strw.Write(richTextBox1.Text);
strw.Close();
strw.Dispose();
}
}
There probably is a super easy solution to this, but I'm quite new to C# and can't figure it out. Any help is appreciated!