how to append text to lines of texbox?-Collection of common programming errors
Setting Lines may trigger the _TextChanged
event again. What is the error you are getting? If you see a StackOverflowException, this is the cause.
You could possibly add this to get around the problem, or take the bool flag approach Daniel mentioned in his answer.
text.TextChanged -= textBox1_TextChanged;
text.Lines = currentLines;
text.TextChanged += textBox1_TextChanged;
Also, perhaps this question discussing the difference between programmatic changes and user driven changes is of interest to you.