How to add new line to a text file in C#

1 Answer

0 votes
namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            File.AppendAllText("data.txt", "the new line" + Environment.NewLine);
        }
    }
}




/*
 * run:
 *
 * 
 * 
 */

 



answered Aug 11, 2023 by avibootz

Related questions

1 answer 100 views
100 views asked Aug 13, 2023 by avibootz
1 answer 146 views
146 views asked Dec 23, 2016 by avibootz
1 answer 204 views
1 answer 199 views
199 views asked Jul 1, 2014 by avibootz
1 answer 157 views
1 answer 116 views
...