private void button1_Click(object sender, EventArgs e) { textBox2.Text = ""; string str = ""; foreach (string s2 in textBox1.Lines) { if(s2==""){ continue; } str += s2.Trim()+"\r\n"; } textBox2.Text = str; }