Advance to next line with AppendAllText C#

tjmudder

Member
Dec 16, 2006
77
0
0
I'm working on a program for my C# programming class. There is one small thing I cannot get to work. I have to output information to a text file within my Windows program. As I enter data I "register" it and it outputs to a text file. Then I enter a new set of data which is to output to the line below it. I am using AppendAllText to do this as I was instructed to do by my professor. Below is my line of code that I have currently. Everything works fine, including the tabs. I just cannot get a new line to appear when I enter a new set of data. The data just appears after the previous date on the same line in the text file. Can anyone help?

File.AppendAllText(rptFile, StudentName.Text + "\t" + radButton + "\t" + Charge + "\t" + OutLesson + "\t" + Outcost + "\n");
 

bsobel

Moderator Emeritus<br>Elite Member
Dec 9, 2001
13,346
0
0
You wanted to use + "\r\n" instead of + "\n" but ideally you'd actually say + System.Enviroment.NewLine

Bill