如何在窗体应用程序中打破一行?

问题描述:

我想在窗口形式中打破一行..



在按钮单击事件中,我在文本区域和下一次单击中显示文本下一个文字应该以新的一行显示..任何人都可以帮忙吗???





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???


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

重写你的代码

textBox2.Text + = textBox1.Text + \ n \\ n;



as



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

as

textBox2.Text += textBox1.Text + Environment.NewLine;


通过使用Environment.newline属性,我们可以得到这个...



By using Environment.newline property we can get this...

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