自定义蒙版编辑验证事件触发两次 [英] Custom Masked Edit Validating Event Fires Twice

查看:80
本文介绍了自定义蒙版编辑验证事件触发两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我们有一个已从VB6迁移到VB.NET的应用程序.我们已经创建了Masked Edit自定义控件,并具有Masked Edit控件的其他行为.此外,我们还有一些验证方法,可以验证在控件的Leave事件期间输入到自定义控件中的文本.

当我们跳出控件时,事件正常运行,问题是我们使用了一个底部的窗体,该窗体具有用于导航到其他窗体的按钮,因此,当我们单击下一个按钮时,验证事件将首次触发两次,否则运行正常.

我一直在寻找控件的这种奇怪行为,但是找不到任何合适的解决方案.

希望我能在这里找到解决方法.
预先感谢.

Hi all,

We have an application that has been migrated from VB6 to VB.NET. We have created Masked Edit Custom Control with additional behaviors to the Masked Edit control. Also, we have some validaton that validates the text entered into the custom control during the Leave event of the control.

The Event works properly when we tab out of the control, the problem is we use a bottom form which has buttons to navigate to other forms, hence when we click either the next button the validation event fires twice for the first time, other times it is working perfectly.

I have been searching about this odd behaviour of the control, but couldn''t find any proper solution for this.

Hope I get some solution here.
Thanks in advance.

推荐答案

在事件处理程序的结尾,将e.Handled设置为true,看看是否可以解决您的问题.
At the end of the event handler, set e.Handled to true, and see if that fixes your problem.


这篇关于自定义蒙版编辑验证事件触发两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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