Click here to Skip to main content
Click here to Skip to main content

Simple Validation Control for WinForms

, 26 Jul 2009
Rate this:
Please Sign up or sign in to vote.
This VB.NET validation control can be used like validation control of ASP.NET


Many times programmers need to validate the user input at form level. ASP.NET provides validation control for web based development.

On a similar basis, we have introduced an updated version of the validation control for Windows application. This version provides validation for:

  1. Numeric only 
  2. Any string (non-numeric) 
  3. Characters only
  4. Regular expression based 
  5. Range Validator
  6. Required field validator

It also contains a control Validation Summary which reports False if any control text is not valid. At the form level, we can check the status of all controls using:


If any one of the controls contains invalid input, then it will return False.

How to Use

Validation control is very simple to use. Follow these steps to add validation to your form controls:

  1. Add the Validation control in the Tool Box.
  2. Drag one on to form. 
  3. Set ControlToValidate property to the control you want to validate (Just choose from dropdown list).
  4. Set to Validation as property to either numeric only, any string (non-numeric) or characters only or RegularExpression. 
  5. If you have selected Regular expression, then you need to set Regularexpression text.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

KundanKumar Ugale
Web Developer
India India
KundanKumar Ugale
+91 9860526936

Comments and Discussions

SuggestionProblem with MaskedTextBox PinmemberCool Dirty Boy9-Sep-11 0:56 
QuestionProblems panel or GroupBox Pinmembermarioneta13-Oct-09 9:11 
AnswerRe: Problems panel or GroupBox PinmemberMohammed Mohammed Abdelhay7-Feb-11 23:07 
QuestionUse System.ComponentModel.IExtenderProvider ? PinmemberDuncan Edwards Jones27-Jul-09 2:21 
Suggestion: If your control inheritted from System.ComponentModel.IExtenderProvider it could provide validation for all the controls on a form in a similar fashion to the way the Tooltip component works.
Ex Datis:
Duncan Jones
Merrion Computing Ltd

GeneralMy vote of 1 PinmemberAxelM26-Jul-09 21:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 26 Jul 2009
Article Copyright 2006 by KundanKumar Ugale
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid