Textbox Ctrl+C/Ctrl+V not working, is something to do with form being an MDI child

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
Ive been banging my head on something for a long time - in some apps i write, a textbox will accept me pressing Ctrl+C Ctrl+V to copy and paste etc. In other apps it doesnt work.

Ive eventually figured out today, that if the textbox is on a form that is an MDI child, then the keyboard shortcuts dont work. Maybe this is because they are being consumed before they reach the control, i dont know.. but i'd appreciate a solution if anyone knows how to mend this issue.. :)

regards
Matt
 
I found this post at another forum:
Gaurav said:
They are being handled by the MDI form generated.

For the controls:

copyToolStripMenuItem

and

cutToolStripMenuItem

look for the propery:

ShortcutKeys

The values are set to Control+C and Control+X.

Just clear them or provide code to:

CopyToolStripMenuItem_Click

and

CutToolStripMenuItem_Click

--

Cheers,

Gaurav
 
Brilliant! Thanks for that tip, John.. I'd used a wizard to make an MDI desktop form, which had a canned Edit menu on it - Cut Copy and Paste were all implemented with do-nothing methods and attached to the shortcut keys. I removed the menu (it's extraneous) and the handling code and my copy/paste is working again. Thanks for your help!
 
Back
Top