RichTextBox undo/redo function doesn't work

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
 
S

Shakir Hussain

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

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

Martin M?ller

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top