I made a function in vb.net for string validation,integer validation in which on "key press event" i restricted some values , but the problem is that my codes work in key press event well but when a user copy the wrong text and paste in text box it accepts. i want to know that how can i validate string and integer validation on the key press , when a user paste wrong values than it must alert.
What I have tried:
i wrote this function
''string validation
Public special_charcters = "~`!@#£€$¢¥§%°^&*()-_+={}[]|\/.:;,""''<>?"
If e.KeyChar <> ControlChars.Back And e.KeyChar <> " " And Keys.Control Then
e.Handled = (Char.IsDigit(e.KeyChar))
Dim ValidInputChar = special_charcters + vbBack
If ValidInputChar.Contains(e.KeyChar) Then
e.KeyChar = Nothing
e.Handled = False
End If
End If