Word wrap and new line Richtextbox

ryoka012

Active member
Joined
Oct 13, 2011
Messages
32
Programming Experience
Beginner
Hi Experts,


I hope anyone can help me with this.

My problem is how can i recognize a new line when my text is in word wrap on textchange event.

Example:

Richtextbox text
QUICK BROWN FOX JUMP
OVER THE LAZY DOG

But in reality the text are is in this format as one line
QUICK BROWN FOX JUMP OVER THE LAZY DOG

How can i make it to the format text as is when the user type it.


Thanks guys.
 
I don't really understand what you're asking. If the user enters a line break in a RichTextBox then the control will display a line break at that location in the text. I don't really know what you're trying to achieve that isn't already happening. If you're saying that you don't want the text to wrap unless the user actually enters a line break then just turn word wrap off.
 
Hi jmcilhinney,

Thanks for the reply and sorry for the confusion.

What i mean is that the next line of word wrap is not a line break.

I have tried to test it using a richtextbox and a label and type a text in richtextbox and print the output on the label.

When the text are word wrap in richtextbox but the output in the label are one line but when i use line break(enter) it break the line on the label.

I have attach a screenshot:

Untitled.png
 
Are you saying, without actually saying, that you want the text to wrap in the Label in the same way as it does in the RichTextBox? A Label wraps by default so all you have to do is make the Label the same size as the RichTextBox and it will happen all by itself.
 
Sorry for confusion.

Yes that is what i mean, and i have tried that.but the text does not reflect on my Backend format.
 
What backend format? You said you wanted a Label and RichTextBox to wrap your text the same way and that will happen if you make them the same size. I've tested it and it works. If it didn't work for you then you did something wrong.
 
Back
Top