使用事件处理程序时的困惑 [英] Confusion in using Event Handlers

查看:53
本文介绍了使用事件处理程序时的困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请我想知道在使用DataGridView_Cell_End_EditDataGridView_Cell_Validating事件处理程序的同时使用DataGridView_Key_Down事件处理程序或在DataGridView中保留编辑的cell 时是否存在任何问题,
如果是,请告诉我如何解决.

预先感谢,
:)

Hi all,

Please I want to know if there is any problem to use the DataGridView_Key_Down event handler in the same time I am using The DataGridView_Cell_End_Edit or DataGridView_Cell_Validating events handler or when leaving an edited cell in the DataGridView,
If yes please tell me how to fix it.

Thanks in advance,
:)

推荐答案

尽管问题不够充分,但让我给出有关这些事件的一般要点.

如果查看事件的顺序,则首先触发容器事件KeyDown.然后,如果单元格控件处于编辑模式,则单元格验证并结束编辑.

但是,如果单元处于编辑模式,则不会触发容器的Down键.因为该事件将由单元而不是gridview捕获.

如果要让gridview捕获特定的键事件而不是单元格,请在此处查看可行的解决方案

GridView KeyDown事件捕获; [
Though the question didn''t provide enough, Let me give the general points about those events.

If you look at the order of events the container event KeyDown fires first. Then Cell validating and End Edit if the cell control is in editing mode.

But the key Down of the container won''t fire if the cell is in editing mode. Because the event will be captured by the cell and not the gridview.

If you want the gridview capture the specific key events instead of the cell then look at here the workable solution

GridView KeyDown Event Capture;[^]


这篇关于使用事件处理程序时的困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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