Click here to Skip to main content
14,237,394 members
Rate this:
Please Sign up or sign in to vote.
i have a textbox that is used for naming something.I need to make it so it doesn't accept these characters / | \"" < > ? * . Any help is appreciated. I would like to make it that it doesn't even enter them into the tbox like windows 7 does but i dont Know how.Thanks In Advance!!

What I have tried:

i tried excluding them but if i enter more than one in it with letters in between it doesnt kick it out.
Posted
Updated 2-May-18 4:12am
v2
Comments
BillWoodruff 2-May-18 10:48am
   
You can easily solve this problem using the recently posted code examples shown here:

https://www.codeproject.com/Answers/1241997/How-to-write-a-regular-expression-which-will-accep
Rob Philpott 2-May-18 12:32pm
   
Yep. I like the keypress intercept - it's a classic!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100