How to override Undo functionality from MemoEdit.

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?
Who is Participating?
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
Jacques Bourgeois (James Burger)PresidentCommented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.