Tony

Tony

  • NA
  • 30
  • 0

How to display a long string in a TextBox

Nov 3 2009 12:34 PM

I have a C# app that through a Reflection terminal emulator API pulls information off a screen line by line and adds each line to a string.  Between each line is a \n.  Later in the code the completed string was being correctly displayed in a MessageBox.   This was great until one of the screens included a MORE button which means there are multiple screens of data.   I can add the additional lines of data to the string but the MessageBox gets really large necessitating a scrolling capability.     So, I used a TextBox with scrollbars, multiline, etc.   The problem is that the data is no longer correctly formatted.  It acts like TextBox does not see the newline.  I have read many postings suggesting using Environment.NewLine instead of \n but it results in the same formatting unlike it was using the MessageBox.  
I am relatively new to C# and am hoping someone can point in the right direction on how to handle this.    Any advise will be much appreciated.
 

Answers (3)