سؤال

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?

هل كانت مفيدة؟

المحلول

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

TextBoxBase.ShortcutsEnabled Property

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top