Articles in this section
Category / Section

How to catch the arrow keys of a ComboDropDown control?

1 min read

 

To catch the arrow keys of the ComboDropDown control, you need to derive from it and override its ProcessCmdKey as shown below:


[C#]

//Derived ComboDropDown control
public class MyComboDropDown : Syncfusion.Windows.Forms.Tools.ComboDropDown
{
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
        if (keyData==Keys.Left ||keyData==Keys.Right || keyData==Keys.Up || keyData==Keys.Down)
        {
            MessageBox.Show("Arrow Key: " + keyData.ToString(),"MyComboDropDown");
        }
        return base.ProcessCmdKey (ref msg, keyData);
    }
}


[VB.NET]

'Derived ComboDropDown control 
Public Class MyComboDropDown   Inherits Syncfusion.Windows.Forms.Tools.ComboDropDown 
    Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean 
        If keyData=Keys.Left ||keyData=Keys.Right Or keyData=Keys.Up Or keyData=Keys.Down Then 
            MessageBox.Show("Arrow Key: " + keyData.ToString(),"MyComboDropDown") 
        End If 
        Return MyBase.ProcessCmdKey ( msg, keyData) 
    End Function 
End Class

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied