Hello world of DaniWeb, it's been months since I last visited this forum but here I am asking for your help again :)

I've been developing a text editing application and my problem is that the RichTextBox control will "lose" all special formatting (like font, color etc.) when enabling WordWrap. Can you please help me out on this one?

P.S: If you need any code in order to help me solve this problem, just let me know and I'll post it right away!

Recommended Answers

All 3 Replies

See if this helps, if not, do post code.

Dim tempStr As String = RichTextBox1.Rtf '// store Format into String.
        RichTextBox1.Clear() '// clear if needed.
        If RichTextBox1.WordWrap = True Then : RichTextBox1.WordWrap = False : Else : RichTextBox1.WordWrap = True : End If '// toggle WordWrap.
        RichTextBox1.Rtf = tempStr '// set Formated text back.

Edit: Double posted since DaniWeb took too long to Submit/Load webpage.

Thank you very much dude! It worked!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.