Click here to Skip to main content
15,886,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I have one datagridview in c# (windows application) in which there is one combo box
what i want is when ever some one press escape key on that combobox a message should be displayed like 'Invalid key'.

Please help me out in making this...

Thanks in advance,

Regards,
Krunal Panchal
Posted
Comments
Oludayo Alli 7-Sep-11 9:58am    
are u doing this in WinForm or WPF?

 
Share this answer
 
Hi,
There are little bit difference between keyPress event and keyDown event.. try the below:

C#
private void comboBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                MessageBox.Show("Invalid key");

            }
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900