如何检查 C# 中其他按钮单击事件中是否发生了离开事件
我为文本框调用了离开事件,并在其中调用了另一个名为“检索按钮”的按钮事件。所以现在我只想检查这个检索按钮事件是否调用了文本框的离开事件?
I have called a leave event for a a text box and in it called another buttons event named Retrieve button. so now I just want to check in this retrieve button event weather the text box's leave event is called or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您从文本框离开(模糊)事件调用检索按钮事件时,您可以简单地将一个标志添加到 eventArgs 中,您可以在检索按钮中检查该标志。仅当您隐式调用检索按钮(甚至是从文本框离开事件中)时,才会设置此标志。
这意味着如果从其他地方调用检索事件,则不会设置该标志,因此您可以知道该调用肯定来自按钮离开事件。
When you call the retrieve button event from the text box leave (blur) event you could simply add a flag into the eventArgs that you can check in the retrieve button. This flag would only be set when you implicitly call the retrieve button even from the text box leave event.
This would mean that if the retrieve event is called from other places the flag would not be set so you could tell that the call definitely came from the button leave event.