|
-
October 16th, 2011, 03:03 AM
#2
Re: Restrict text input
Hello Nmohammed, the following code will allow only a-z and A-Z characters to be entered into the textbox. You'll need to create the KeyDown event for the textboxes, in order to utilize the code. In the future, I'd also like to suggest, for readability, to use [ code ] tags, on your code. Enjoy.
Code:
private void txtTextbox1_KeyDown(object sender, KeyEventArgs e)
{
if ((e.Key < Key.A) || (e.Key > Key.Z))
e.Handled = true;
}
Regards,
Quinn
If this post resolves your question, please make sure to flag post as resolved and please rate up this post. Thanks.
Last edited by QuinnJohns; October 16th, 2011 at 03:06 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|