Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable CTRL + C, CTRL + X, and CTRL + V?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Is it possible to disable CTRL + C, CTRL + X, and CTRL + V? I would like to disable copying, cutting, and pasting. If yes, please show me some sample code or a hyperlink. Thank you very much.

Trev
 
Set KeyPreview=True for the form.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (Shift And vbCtrlMask) Then
Select Case KeyCode
Case vbKeyC, vbKeyV, vbKeyX
KeyCode = 0
End Select
End If
End Sub

Compare Code (Text)
Generate Sort in VB or VBScript
 
Could you please tell me where to put this code? I am just starting out.

As soon as the form loads, is it supposed to disable ctrl+c, ctrl+v, and ctrl+x? or do i have to call it from within code for a command button or something?

 
As the name indicates, it is the Form_KeyDown event. It executes everytime a key is pressed while the form is active.

Set KeyPreview = true for the form at design time or at run-time.
in Form_Load it would be
Me.KeyPreview = True

Go to Barnes & Noble or Borders and find a book that suits you. You need the "basics" of VB. You'll take forever getting them here, one by one. Compare Code (Text)
Generate Sort in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top