Click here to Skip to main content
Licence CPOL
First Posted 2 May 2006
Views 26,744
Downloads 822
Bookmarked 22 times

Simple Validation Control for WinForms

By | 26 Jul 2009 | Article
This VB.NET validation control can be used like validation control of ASP.NET

Introduction

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:

ValidationSummary1.ValidateInput() 

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.

License

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

Member

KundanKumar Ugale
 
kundan.ugale@gmail.com
+91 9860526936
Mumbai(India)

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
SuggestionProblem with MaskedTextBox PinmemberCool Dirty Boy0:56 9 Sep '11  
QuestionProblems panel or GroupBox Pinmembermarioneta9:11 13 Oct '09  
AnswerRe: Problems panel or GroupBox PinmemberMohammed Mohammed Abdelhay23:07 7 Feb '11  
QuestionUse System.ComponentModel.IExtenderProvider ? PinmemberDuncan Edwards Jones2:21 27 Jul '09  
GeneralMy vote of 1 PinmemberAxelM21:01 26 Jul '09  

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.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 26 Jul 2009
Article Copyright 2006 by KundanKumar Ugale
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid