How to override Undo functionality from MemoEdit.

Posted on 2011-10-31
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

    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

    Expert Comment

    by:Jacques Bourgeois (James Burger)
    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

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    WS_CHILD window 14 36
    VB.Net - How to update a database 4 33 check for multiple values 5 29
    Custom auto number 6 26
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now