Silver007
Silver007

Reputation: 91

How do I create a new line in TextBox whenever it starts a new row in C#?

I want to get a specific line from a text showed in a TextBox (could be RichTextBox as well, it doesn't really matter), but TextBox.Lines Method recognize a new line only if there was an "Enter" inside the text.

My text is continuous, but the TextBox drops a line at a time runs out place on the same line. Is it possible to get a specific row from the text box by its length?

Upvotes: 2

Views: 89

Answers (1)

John
John

Reputation: 3702

After wordwrap in a textbox, you can make use of this function:

textBox1.GetFirstCharIndexFromLine(line);

Upvotes: 3

Related Questions