Showing posts with label TextBox. Show all posts
Showing posts with label TextBox. 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;

Adding textbox values to all the datagridview rows c# code

DataGridView control in Windows forms:
             DataGridView control is the windows forms tool as like  GridView in the ASP web designing.To add the values from the textbox to datagridview first you have to add the datagridview columns statically.For the go to properties at the bottom of the propertie window you will see Edit columns property. By clicking that property you will get a window. there you can add , remove and set the special properties of those columns. The DataGridView control makes it easy to define the appearance of cells and the display formatting of cell . The cell is the fundamental  unit of interaction for the DataGridView. We can add the different types of controls in each cell as combobox, link, image etc. All cells derive

Set errorprovider to the textBox C#

ErrorProvider Control:
             This article will explain the use of the error provider control in Win Forms application development.The error provider control is most useful to display errors associated with data entry tasks on a Windows form. The error provider control is typically used to show errors related to data entry.For example, successful entries could be shown with a green checkmark as easily as failed entries could be shown with the standard red ball exclamation mark.  When user enters invalid value to the textbox then the errorprovider will be set or the user enters the currect value then errorprovider will be clear.You can use one errorprovider to display more error to different controls.

Autocomplete mode for textbox in C# .net

AutoComplete Mode for TextBox control in C#

               Textbox control have the AutocComplete mode in C Sharp language.When one perticular field will be with related data that time we can set the autocomplete mode to the textbox.This feature does not there in the VB.Net language.When using the vb.net code user must enter the entair field.Autocomplete mode is very usefull feature to the user. Autocomplete mode will work like Google search engine. While user entering the data, the word completion will come as a dropdown to the textbox from a perticular field from database.For that you have to write the select statement from that perticular database.

Add values from textBox to dataGridView C#

DataGridView Control:
            Datagridview is the one of the efficient control in C#.The DataGridView displays the contents of a data source. It is a control in Windows Forms that uses a grid format. Inserting the values from textbox to datagridview control is easiest way. For that first you have to add one windows form.Add atagridview control,five textboxes and one button to the form or webpage.Add five columns to the datagridview control statically and namethe columns as name,class,city,phone and zipcode. Click here for more information about datagridview control.

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.