Code to illustrate the use of Environment.NewLine property

Posted by Ddd under Windows Forms category on | Points: 40 | Views : 3055
NewLine property of Environment class can be useful in giving line breaks between 2 strings.

This is shown in this example.

Take a Window application. Put 3 textboxes and one button.

We have to enter two strings in 2 textboxes and display their concatenation in the 3rd textbox

with a line break.

private void button1_Click(object s, EventArgs e)
string a=textBox1.Text;
string b =textBox2.Text;

Try it.

Comments or Responses

Posted by: T.saravanan on: 1/19/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi Dinesh.K,

Nice Try,Also add one point in your code.In TextBox3 (Output TextBox) set multiline property is true. Then only user view the proper output.
TextBox3.Multiline = true ;

Kindly post your code using code tag.

Cheers :)

Login to post response