I have prevented numbers from being typed in text box using key down event. But when using Ctrl+V or pasting content through mouse, the numbers are being entered in the text box. How to prevent this? I have to allow all text to be pasted/typed except numbers.
Share
On quite simple approach would be to check the text using the
TextChangedevent. If the text is valid, store a copy of it in a string variable. If it is not valid, show a message and then restore the text from the variable:This will handle any occurrence of numbers in the text, regardless of where or how many times they may appear.