RichTextBox undo/redo function doesn't work

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Hi all,
I want to hilight some syntax keywords. While parsing text, I used these
properties such as SelectionStart,SelectionLength and SelectionColor of
RichTextBox. Although the syntaxhilghting effect was reached, I found
original undo/redo function didn't work!!

Any ideas?

Thanks,

Alan
 
You have to check first whether richtextbox is capable of undoing the
previous operation

if(richTextBox1.CanUndo == true)
{
richTextBox1.Undo();
}
 
Shakir Hussain said:
You have to check first whether richtextbox is capable of undoing the
previous operation

if(richTextBox1.CanUndo == true)
{
richTextBox1.Undo();
}

Hi!
I just found out that accessing the Text or Rtf property of a
RichTextBox clears the Undo buffer, so this could explain your
problems.
Even read access clears the buffer, and that stinks big time.

Haven't found a way around this yet.

Regards,
mav
 
Back
Top