Showing posts with label Validation. Show all posts
Showing posts with label Validation. Show all posts

How to textbox validation for currency in c#

The code I have written here will be usefull to validate the currency format.
 That means It will not take '.' value at the start of the textbox. The textbox will allow only two digits after the '.' value and only allows numeric values. Try it for validating money and percentages.

     TextBox tbprice = sender as TextBox;

TextBox validation for currency (adding" .00 " at the end )

Adding ".00" automatically at last 
        This code will validates currency value, means it will add " .00 " value automatically at the end of the value entred by the user. Validation for textbox will be validate in two ways, one is validate on user interface. This validation will be done at the user interface only,there is no need of database connection. And another validation type is validate with the database connection. Checking duplication is one of the such validation type. For the when user clicks the save  button, the data will be from database and shows a error message to the use.This code will validate on user interface only.

TextBox Validation for Email address format

TextBox Control :
Represents a control that can be used to display or edit unformatted text. This control has additional functionality that is not found in the standard Windowstext box control, including multiline editing and password character masking.
TextBox Validation for Email address format :
Email address will be in a perticular format. Every email id will have @ symbol, that is the rule

Code for TextBox validations in .Net


TextBox Control :
This control is able to enter the data by the user and send from the textbos to anywhere like saving to database, send to another textbox, insert to datagridview cells etc. 
TextBox validation for restrict Lettres :
This code will not allow the lettres from A to Z . Except those remaining charecters, symbols and special charecters will be allowed.