Tuesday 23 October 2018

Keypress event in Textbox for Characters

Using the below code you can only enter characters to the textbox. Here you have to paste this code in the keypress event of the textbox which is there in the property of that textbox.

if (char.IsLetter(e.KeyChar) || e.KeyChar == 8)

            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }

No comments:

Post a Comment