Visual Basic中的Combobox,Textbox,NumericUpDown和MaskTextBox验证! [英] Combobox, Textbox , NumericUpDown and MaskTextBox validation inVisual Basic!
本文介绍了Visual Basic中的Combobox,Textbox,NumericUpDown和MaskTextBox验证!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
帮助,我已经搜索了许多站点,但是在Visual Basic中却找不到关于这些站点的信息.
Help, I have searched many sites and found very few information on these in Visual Basic.
推荐答案
如果您在用户尝试退出时进行验证控制,我想最简单的方法是使用验证 [ ^ ] 事件.在这种情况下,您可以使用例如正则表达式来检查输入.
NumericUpDown自动仅接受数字,并且MaskedTextBox具有遮罩 [ ^ ]属性,您可以在其中定义适当的遮罩.
If your doing the validation when the user tries to exit the control, I guess the simplest way is to use Validating[^] event. In that event you could use for example regex to check the input.
NumericUpDown automatically accepts only numbers and the MaskedTextBox has the Mask[^] property where you can define a proper mask.
这篇关于Visual Basic中的Combobox,Textbox,NumericUpDown和MaskTextBox验证!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文