Getting Ctrl + v to work on your MDIChild form's Textbox

Posted on 2009-04-27
Last Modified: 2013-12-17
I need to make the Copy, Paste work on my MDIChild Form's textBox.

On Googling I found that ProcessCmdKey method needs to be overriden on MDI Parent and SendMessage api function needs to be used to let the MDI Parent form forward the keystrokes to the MdiChild form.

When I wired the ProcessCmdKey, the textbox on the MDIChild form stopped taking any keys at all. Can someone please step me through it ?

I just did a little test. I created a different winforms app, with 1 MDI and 1 Child form in it. I put a text box on child form.
I created a user control in the same project and put a text box in it, and than put that user control on the child form.
I ran the app, and loaded the child form through mdi form's Load event.
I copied some text from some other app, and did the "Ctrl + v" on both the text boxes (simple text box and textbox inside the user control), they both worked fine!!

now i am confused, what's really goin on?

I think I didn't give the enough Information before.
My MDI Form is being derived from a BaseForm which is in turn derived from Form class.
I copied BaseForm class to my new test project (which I mentioned above in UPDATE 1) and made my child form and the MDI form derive from this BaseForm, but it still works ok, ie Ctrl + C, Ctrl + V works fine on textbox on child form.

Can someone help me brainstorming with this ?

Question by:DPalkar
    1 Comment

    Accepted Solution


    Well Thanks whoever atleast took a look at this problem.
    Because the solution has turned out to be something really obvious and funny.
    I had a Menustrip on my MDIForm, everybody does!
    But I had a Menu Item called "Edit" with all sub menu items like cut, copy paste etc..(again everybody does)
    And these 3 items had the shortcut keys set with Ctrl+x, Ctrl+c, Ctrl+v respectively.
    I think that's where the key strokes were being desolved. But it never occured to me because at runtime as well as the designtime (Unless u click on the menu strip) the Edit Menu was invisible.

    Well,  It was a good long excercise in the end.
    After 2 days of hair snatching, I could atleast give that excuse to myself.

    Thanks anyway

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    760 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

    12 Experts available now in Live!

    Get 1:1 Help Now