I have tried if (e.Control && (e.KeyCode == Keys.Z)) RTB.Undo(); and .Redo() but nothing reflected in the richtextbox. I tried with sendmessage too. Any help would be great.
Asked
Active
Viewed 1,162 times
0
-
Have you tried debugging and setting a breakpoint on the Undo(). – Richard Schneider Jan 16 '13 at 10:03
-
@RichardSchneider Yes, I have. I am writing this inside KeyDown event. I also saw that Undo does not work with KeyPress and textChanged events. Is there a need to set the clipboard text everytime? I am really confused here. – Milee Jan 16 '13 at 10:09
-
@RichardSchneider may be i am missing to set some property here. No idea... – Milee Jan 16 '13 at 10:12
-
`Undo` returns true if something has been undone. Maybe you check the result. – Richard Schneider Jan 16 '13 at 10:13
-
@RichardSchneider undo has a void return type... – Milee Jan 16 '13 at 10:16
-
Sorry I was looking at the PresentationFramework documentation not Winforms! I have no more ideas – Richard Schneider Jan 16 '13 at 10:20
1 Answers
0
i tried id and it works correctly.
if (e.Control && e.KeyCode == Keys.Z)
richTextBox1.Undo();
did you enable the KeyPreview Property of current form for start catching key downs?
talking about this property.

Lütfullah Kus
- 302
- 1
- 12
-
-
talking about form properties.and you dont need to set the clipboard text everytime.rtb doing it already. – Lütfullah Kus Jan 17 '13 at 08:21
-