Datagridview控件上的按键事件 [英] Key pressed event on datagridview control

查看:82
本文介绍了Datagridview控件上的按键事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在C#(Windows应用程序)中有一个datagridview,其中有一个组合框
我想要的是,只要有人在该组合框上按某个转义键,就会显示一条消息,例如无效键".

请帮我做这个...

预先感谢,

问候,
Krunal Panchal

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

推荐答案

Hi;

检查此链接

http://stackoverflow.com/questions/1798383/press-escape-key-to-call-method


祝你好运
Hi;

Check this link

http://stackoverflow.com/questions/1798383/press-escape-key-to-call-method


good luck



keyPress事件和keyDown事件之间没有什么区别.请尝试以下操作:

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

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

            }
        }


这篇关于Datagridview控件上的按键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆