I have a TextBox where I need to show some text. The length of the text is dynamic, so it needs to be wrapped to fit into multiple lines.
The maximum length of a line is 50 characters. If the text is more than that, I need to add a line break \n.
For example, if the text is 165 chars:
- Add a
\nat 51st position - Add a
\nat 102nd position - Add a
\nat 153rd position
So finally the total length of text will be 168 chars.
I know how to do this using a loop. But my question is, can this be done without much code? Does the String class have a method to provide that function?
This is a Windows Forms app, but all controls including TextBox are created programmatically.
