TextBox Validation
Sometimes we can make the Textbox to AcceptOnly Number is any other value is entered then we may alert the user toenter the Numeric value.In C# what we have to do is write the Validateevent for each and every Textbox to be validated for Numbers.
What the program does is it extends the C#'sTextbox class and Wrap the Validated within the child class so thatuser can the ChildClass for textbox to be validated for numbers withoutwriting code for each and every textbox.
ie.
Consider for eg we want to validate for 2 Textbox then we have to write code like this:
TextBox t1=new TextBox();
TextBox t2=new TextBox();
t1+=new CancelEventHandler(Validatingfunction)
t2+=new CancelEventHandler(Validatingfunction)
using the Code i sent to you without worrying abt the
Validation u can simply code it like this:
NumberBox n1=new NumberBox();
NumberBox n2=new NumberBox();
The above 2 will create 2 textbox and has all the features of textbox along with the Number validation in built.
Download NumberBox.cs




19. Jan, 2006 by 







No comments yet... Be the first to leave a reply!