I’m using a RichTextBox in WinForms 3.5 and I found that when I programmatically edit the contained text, those changes are no longer available to the built in undo functionality.
Is there a way to make it so these changes are available for undo/redo?
Here’s just some code I decided to mess around with:
It’s basically me writing my own Undo feature. All I’m doing is storing the old value in one buffer variable, and the new value in a second buffer variable. Every time the text changes, these values get update. Then, if the user hits ‘CTRL-Z’ it replaces the text with the old value. Hack? A little. But, it works for the most part.