By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,257 Members | 925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,257 IT Pros & Developers. It's quick & easy.

Trap Paste event

P: n/a
When a user types Ctrl.+V in one form, I would like to trap the event and do
something else.
Is this possible?

Matthew
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Set the form's KeyPreview property to true.

Enter the following event handler

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.Control And (e.KeyCode = Keys.V Or e.KeyCode = Keys.Insert)
Then
'Something pasted on the form.
End If
End Sub

Scott Swigart
blog - http://ea.3leaf.com
"Matthew" <tu*************@alltel.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
When a user types Ctrl.+V in one form, I would like to trap the event and
do something else.
Is this possible?

Matthew

Nov 21 '05 #2

P: n/a
> Set the form's KeyPreview property to true.

Enter the following event handler

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.Control And (e.KeyCode = Keys.V Or e.KeyCode = Keys.Insert)
Then
'Something pasted on the form.
End If
End Sub


That's it! Thank you, Scott.

Matthew
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.