计时器事件,按钮单击事件-两者不应冲突 [英] Timer event, button click event - both should not conflict

查看:168
本文介绍了计时器事件,按钮单击事件-两者不应冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在胜利形式中,我使用计时器控件来检查数据库状态(例如每5分钟一次),但是在相同形式中,可以使用带有按钮的网格来进行某些处理

在上述情况下,第二个所说的过程[button click]比第一个重要.
所以在任何情况下我都不想第二个所说的过程[按钮单击]会被计时器操作或触发器打扰.

如何避免这种冲突

in a win form, i have used a timer control in order to check DB status say every 5 min, but in the same form a grid is available with buttons to do some process

here in above scenario, the 2nd said process[button click] is more important than the first one.
so i don'' t want at any situation the 2nd said process[button click] should get disturbed by timer action or trigger.

How to avoid this conflict

推荐答案

因此,在按钮click事件处理程序中,停止计时器.重置它,然后在完成Click事件后再次启动它.
So, in the button click event handler, stop the timer. Reset it, and start it again when you have finished the Click event.


这篇关于计时器事件,按钮单击事件-两者不应冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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