In C we have a habit of using "\n" for new line and "\r" for carriage return.Some operating systems use the value 0x0a ('\n') to mark the end of a line. Some use the value 0x0d ('\r') to mark the end of a line. Some use the sequence 0x0d,0x0a ("\r\n"). "\r\n" is a carriage return followed by a newline. Since the days of teletype machines is mostly gone, \r\n is usually converted to just \n and handled that way. But the notable thing is that Windows uses NewLine as "\r\n" whereas "\n" in Unix.
In C# you can use "Environment.NewLine" also. Here the code explaining example -:
Label1.Text = "First Line" + Environment.NewLine + "Next Line";
TextBox1.Text = "First Line" + Environment.NewLine + "Next Line";
TextBox2.Text = "First Line\nNext Line";
You have to change textmode property of textbox from singleline to multiline otherwise you wont be able to see the effect like you cant see this effect in Label.
In C# you can use "Environment.NewLine" also. Here the code explaining example -:
Label1.Text = "First Line" + Environment.NewLine + "Next Line";
TextBox1.Text = "First Line" + Environment.NewLine + "Next Line";
TextBox2.Text = "First Line\nNext Line";
You have to change textmode property of textbox from singleline to multiline otherwise you wont be able to see the effect like you cant see this effect in Label.
No comments:
Post a Comment