用简单方法调用事件处理程序方法 [英] Call event handler method in simple method
本文介绍了用简单方法调用事件处理程序方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的先生,
我的问题是当我用简单的方法调用事件处理程序方法时。请帮助,谢谢..
解决方案
< blockquote>不要。
相反,创建一个事件处理程序调用并调用它的方法。
你不要我需要直接调用一个事件处理程序,虽然你可以 - 这只是不好的做法。
如果你必须,那就叫它 - 它是一个方法所以你只需要提供参数。
MyKeyUp(myKey, new EventArgs());
Dear sir,
My problem is that when i call event handler method in a simple method .Please help,thanks..
解决方案
Don''t.
Instead, create a method that the Event handler calls and call that instead.
You don''t need to call an event handler directly, although you can - it''s just not good practice.
If you must, then just call it - it is a method so you just need to provide the parameters.
MyKeyUp(myKey, new EventArgs());
这篇关于用简单方法调用事件处理程序方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文