Friday, March 16, 2012

newline within a string

How can I insert a new line character (\n?) within a string in C#, so that when I display the string in some text box the string is displayed in multiple linesHi,

you can use System.Envirnment.NewLine() method to insert newline. Also if you are using Multiline textbox then I think you need to do something like this:


string AllText = TextBox1.Text.Replace(System.Envirnment.NewLine(),"<BR>");


What I am trying to do is

string strnewline;
TextBox1.text=strnewline;

Now I want to define the strnewline such that
TextBox1.text=strnewline;

displays the text in multiple lines. TextBox1 is multilined.

In short, is there any alternative to C-lang "/n " ?
check the code that I gave you it works !!!!

0 comments:

Post a Comment