Problem solve Get help with specific problems with your technologies, process and projects.

Retrieving formatted RichTextBox control lines

I need to get lines from RichTextBox control as they are formatted. RichTextBox1.Lines returns a whole "paragraph" as one line, but on the screen it looks like 2 or more lines. The reason is, I need to store the lines to database same way as they are showed on the screen. Any suggestions how to do it are welcome.
What you get from RichTextBox.Lines are exactly the lines that the user has entered. It's not about paragraphs, but where a new line (an Enter) exists in the text. The way it looks in the screen is a rendering detail. If you break the text the way it looks in the DB, and then the user resizes the form so that more text fits in a line, how are you going to put that together again? My advice: forget about it. Rely on the implementation of Lines property. It works. It's the logical thing to do. The visual rendering of the text as a paragraph is not important.

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.