Breaking News
Loading...
Saturday 9 February 2013

How to apply letter validation in c#.net

This code user can not enter any digits and symbol in textbox  user anter only letters.

=> Create project.
=> take textbox from toolbox
=> select textbox and goto propeties window and click on event tab.
=> double click on KeyPress event.
=> write following code

CODE:


 //this code is for when user enter any digit then it alllow to enter but when user enter any letters then it does not alloe to enter letters in textbox..
       private void txtSn_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsLetter(e.KeyChar) && !char.IsControl(e.KeyChar))
            {
                e.Handled=true;
            }
        }


--
/\/ir@\/  <(.'.)>

0 comments:

Post a Comment

Thanks for comment

 
Toggle Footer