开发者

User input validation in WinForms

I'm created a few forms in WinForms application and want to implement validation of user input. There are several ComboBox'es and TextBox'es. I have to check that some fields are not empty and some field require decimal number format. I know there are Enterprise Library Validation Blocks and integrated ErrorProvider. What way can you advice in terms of integration’s 开发者_如何学JAVAspeed.

Thanks in advance.


You can do this task without enterprise library, unless your application is really an Enterprise application.

If you are refering to System.Windows.Forms.ErrorProvider then this would be the fastest way. Is a very simple component but I does not make validation, just visual aid. So you will have to do the validation "manually".


I have a custom class where in methods are defined. I also make use of delegates to fire a method on any event.

Edited **

This article might help: C# Validating TextBox Control


I think the best way is to use regular expressions

You can call the validation when each element loses focus, just like some web forms.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜