Click here to Skip to main content
15,608,157 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to prevent copying and pasting bad characters into text box? I have a test box for adding information similar to this Ask a Question text book. The user some time will use another editor (Word, Lotus and etc.) These different editor will leave some type of garbage or bad characters. Also, the this text box has a file or character limit and these bad or garbage characters are invisible to users. These invisible cause the character count to exceed what is expected.
Updated 15-Sep-15 10:40am
Samira Radwan 15-Sep-15 16:33pm    
what do you mean by bad characters? Do you use it as parameter to a SQL query? you could use regular expression. Please be more specific
CHill60 15-Sep-15 16:34pm    
What have you tried?
What platform (WinForm, WebForm, XAML?)
j snooze 15-Sep-15 17:25pm    
You could make a whitelist of acceptable characters and validate the pasted text against that list.

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900