Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,I want to break a line in window form..

In a button click event i am displaying a text in text area and in the next click the next text should be displayed in a new line..can any one help this???


C#
private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text += textBox1.Text + "\n\n";
            textBox1.Text = "";
        }
Posted

Rewrite your code
textBox2.Text += textBox1.Text + "\n\n";

as

textBox2.Text += textBox1.Text + Environment.NewLine;
 
Share this answer
 
By using Environment.newline property we can get this...

C#
private void button1_Click(object sender, EventArgs e)
        {
            //textBox2.Text += textBox1.Text + "\n\n";
            textBox2.Text += textBox1.Text + Environment.NewLine;
            textBox1.Text = "";
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900