如何模仿JavaScript的onBlur事件在Windows窗体? [英] How to mimic JavaScript's onBlur event in Windows Forms?

查看:153
本文介绍了如何模仿JavaScript的onBlur事件在Windows窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows窗体上的电话和电子邮件,文本框,我想在用户离开字段时验证。

I have phone and email textboxes on a Windows Form that I want to validate when the user leaves the fields.

当我双击在Visual Studio窗体设计器的文本框,它创建一个框TextChanged 事件。如想调用validate方法只有当用户完成输入完整的项目,不是每个按键后,这是不太合适的。

When I double click the textbox in Visual Studio form designer, it creates a textchanged event. This isn't quite suitable as want to call the validate method only when the user is done entering the full entry, not after every keystroke.

有没有办法在JavaScript中做到这一点类似于的onblur 事件?

Is there a way to do this similar to onBlur event in JavaScript?

我已经试过鼠标离开关闭聚焦,他们喜欢框TextChanged <所有行为/ code>。

I have tried MouseLeave, Off Focus, and they all act like TextChanged.

如何才能做到这一点?

推荐答案

尝试离开事件。导航到属性页的控件。

Try the Leave event. Navigate to the Property page for your control.

您可以简单地输入您将创建方法的名称。 preSS <大骨节病>输入和Visual Studio将创建适合你的方法。

You can simply type the name of the method you'll be creating. Press Enter and Visual Studio will create the method for you.

这篇关于如何模仿JavaScript的onBlur事件在Windows窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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