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

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 ?

Who is Participating?
DPalkarConnect With a Mentor Author Commented:

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
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.