• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Advance to next line with AppendAllText C#

tjmudder

Member
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");
 
You wanted to use + "\r\n" instead of + "\n" but ideally you'd actually say + System.Enviroment.NewLine

Bill

 
Back
Top