textBox Lines property does not working..

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,
There is a problem with me i want to set a value of specific line of text box.
there is a property lines that is an array of lines from text box.
there are three lines of text in my text box.
i want to change my text box second line from c# and use this line of coding.
myTextBox.Lines[1] = "any text that i want to display";
but there is not any risponse.
Please help me
Amir Hussain
(e-mail address removed)
 
Hi,

Try something like this.

textBox1.Text="";

for(int i = 0; i < 5; i++)

{

textBox1.Text += String.Format("Line{0}\r\n",i );

}

string strText = textBox1.Text;

strText = strText.Replace(textBox1.Lines[1],"any text that i want to
display");

textBox1.Text=strText;



Ken

-----------------------


Hi All,
There is a problem with me i want to set a value of specific line of text
box.
there is a property lines that is an array of lines from text box.
there are three lines of text in my text box.
i want to change my text box second line from c# and use this line of
coding.
myTextBox.Lines[1] = "any text that i want to display";
but there is not any risponse.
Please help me
Amir Hussain
(e-mail address removed)
 
Thanks Ken Tucker,
Now it is working fine, but can i ask you why it doesn't working directly. I mean
why not working as
mytextBox.Lines[1] = "any text";

Amir Hussain;
 
Thanks Ken Tucker,
but why it not working directly i mean
textBox.Lines[1] = "any text";
why this not working..
Again Thanks
 
Back
Top