I have a multiline textbox, and i store the content of the textbox in a sql server DB. But problem arises when someone types ' (single quote). What i want to do is pop up a msgbox and then delete the ' (single quote) but keep the other content untouched.
I tried to use keypress event handler with textbox.undo property but the event undoes all text but the ' (single quote).
Below is my code:
Private Sub txtDescription_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDescription.KeyPress
If e.KeyChar = ("'"c) Then
MsgBox("Error: Single Quote is not Allowed in this field!", MsgBoxStyle.OKOnly, " ' Not Allowed")
Is there any other way to disable single quotes in the whole form??
Thanks in advance