Learn how to a build a cloud-first strategyRegister Now


How to override Undo functionality from MemoEdit.

Posted on 2011-10-31
Medium Priority
Last Modified: 2012-06-21
Hi I woud like to write my own undo functionality for a MemoEdit. However, the control's "KeyDown" event does not capture a CTRL+Z key down. When I press ctrl-Z the control does a one level undo. Is there a way to capture an "Undi" event of equivalent?
Question by:aferia
LVL 18

Accepted Solution

lludden earned 2000 total points
ID: 37057174
Try the keypress event

    Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If e.KeyChar = Chr(26) Then
            e.Handled = True
        End If
    End Sub
LVL 40
ID: 37057335
Try trapping the Ctrl-Z and Escape (you should also trap Escale to cancel undos) at the Form level.

In order to do so, you will need to set the KeyPreview property of the Form to True, otherwise the key events won't fire on the Form.

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question