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@\/  <(.'.)>

Comments

Popular posts from this blog

How to get column value from the selected row in data grid in wpf c#.net

How to make and use web service in Microsoft Dynamics Navision.

How to use Format function in Microsoft Dynamics Navision.