验证在文本框中的文本改变 [英] Validate on text change in TextBox
问题描述
我已经实现的验证规则在我的WinForm一个文本框和它工作得很好。然而,它会检查验证,只有当我卡出了场。我想它是什么输入框,每次的内容变化,尽快检查。另外,我想它只要WinForm的打开检查验证。
I have implemented validation rules on a textBox in my WinForm and it works well. However it checks the validation only when I tab out of the field. I would like it to check as soon as anything is entered in the box and everytime the content changes. Also I'd like it to check validation as soon as the WinForm opens.
我记得设置了一些事件和诸如此类的东西,这样做相当最近,但我似乎无法记住如何。
I remember doing this fairly recently by setting some events and whatnot, but I can't seem to remember how.
推荐答案
TextChanged事件
TextChanged event
在未来,你可以找到所有在MSDN Library中的事件,这里的的 TextBox类参考:
in the future you can find all of the events on the MSDN library, here's the TextBox class reference:
的http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox(VS.80).aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox(VS.80).aspx
这篇关于验证在文本框中的文本改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!