We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

In an MDI parent-child form scenario, how do I disable the shortCuts to the EditControl in the child form so that the parent form can preview them ?

Platform: WinForms |
Control: EditControl |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014


This process involves the following steps.

1. Capture the EditControl's ContextMenu and remove the ShortCut key (for example F5) from the EditControl's ShortCuts, since this functionality will not be required anymore. For information on how to do this, please refer to the KB article – ‘How do I disable keyboard shortcuts for the EditControl?’ which may be accessed from this link :  http://www.syncfusion.com/Support/article.aspx?id=10334

2. Override the ProcessCmdKey() method in the MDI parent form to capture the F5 key. This ensures that F5 ShortCut is previewed only in the MDI parent form and not in the EditControl on the MDIChild form.

[C#] protected override bool ProcessCmdKey(ref Message msg, Keys keyData)   {   const int WM_KEYDOWN = 0x100;   const int WM_SYSKEYDOWN = 0x104;

  if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))   {    switch(keyData)    {     case Keys.F5:      MessageBox.Show("F5 Captured by MDI Parent Form");      break;

    // and any other key that needs to be captured    }       }

  return base.ProcessCmdKey(ref msg,keyData);  }

[VB.NET] Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean   const Integer WM_KEYDOWN = 0x100   const Integer WM_SYSKEYDOWN = 0x104     If (msg.Msg = WM_KEYDOWN) ||(msg.Msg = WM_SYSKEYDOWN) Then    Select Case keyData     Case Keys.F5      MessageBox.Show("F5 Captured by MDI Parent Form")      Exit Function       ' and any other key that needs to be captured    End Select   End If     Return MyBase.ProcessCmdKey( msg,keyData) End Function

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon