Question RichTextBox Highlighting Undo


Sep 16, 2014
Programming Experience
I have a small problem which I hope you can help me with

I have a RichTextBox which contains a small amount of text entered by the user
I have written the code to highlight certain words as they are being entered, similar to syntax highlighting

The problem is that the RichTextBox undo history stores everything, even my highlighting changes, so when the user clicks undo it tries to undo the highlighting changes, not just the user edits

Is there any way to suspend\restore history collection in the RichTextBox or another way to get the RichTextBox to ignore changes made to the text via code

Thank you
Top Bottom