devxlogo

Avoiding Copy and Paste Functions in a Text Box

Avoiding Copy and Paste Functions in a Text Box

Copy (Ctrl+C) and Paste (Crtl+V) functions are already includedin a text-box control, but what if you want to avoid these functions?You might suppose that you can handle Ctrl key combinations withthe KeyDown event, but Crtl+C and Ctrl+V are not detected in theKeyDown event. The answer is to capture these key combinationsin the KeyPress event. Type this line in the KeyPress event ofthe 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.

devx-admin

Share the Post: