Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 7, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Avoiding Copy and Paste Functions in a Text Box

Copy (Ctrl+C) and Paste (Crtl+V) functions are already included in a text-box control, but what if you want to avoid these functions? You might suppose that you can handle Ctrl key combinations with the KeyDown event, but Crtl+C and Ctrl+V are not detected in the KeyDown event. The answer is to capture these key combinations in the KeyPress event. Type this line in the KeyPress event of the text box:

If keycode = 3 or keycode = 22 _
        then keycode = 0
' Where keycode = 3 is the combination 
' of Ctrl+C and keycode = 22 is 
' Ctrl+V.

Pedro Velazquez
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date