Domanda

I have a GUI with some text boxes that can't accept some characters; in order to do so I put some code on KeyPress event but if I paste text from clipboard that event didn't trigger.

If InStr("><;*,!", e.KeyChar, CompareMethod.Text) Then
   e.KeyChar = ""
End If

So I want to disable text paste on some text boxes but I can't find any property to meet that goal. If I use Enable property I can't edit the text box, same for ReadOnly property.

Any idea about how to do it?

È stato utile?

Soluzione

Set ShortcutsEnabled property to False. This will disable Cut, Copy and Paste.

TextBoxBase.ShortcutsEnabled Property

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top