Reputation: 1684
The Output of this code
string fileDateTime = "StepsGA-" + DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss") + ".txt";
string fname = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileDateTime);
File.WriteAllText(fname, txtSteps.Text);
doesn't preserve newline as it should be. All the contents of the textbox are printed in a horizontal long line ! Where have I gone wrong? Thanks !
Upvotes: 5
Views: 10889
Reputation: 1684
Got the answer ! Instead of \n
I needed to use Environment.NewLine
.
Upvotes: 22