Ctrl+X, Ctrl+V, Ctrl+C or Cut, Copy, Paste using the keyboard -> What are their keycode or keychar?

The title says all. For example, what is the keychar or keycode of Ctrl+X. Thank you.
LVL 3
maidinhtaiAsked:
Who is Participating?
 
appariCommented:
you have to do it in Keydown event

    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.Control And e.KeyCode = Keys.V Then
            e.SuppressKeyPress = True
            e.Handled = True
        End If
    End Sub
0
 
PockyMasterCommented:
try the following in the keydown event  

If e.Control And e.KeyCode = Keys.X Then

        End If
0
 
maidinhtaiAuthor Commented:
Hi PockyMaster. This is a clear example:
----------------------------------------
Private Sub TextBox1_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles TextBox1.PreviewKeyDown
         If e.Control And e.KeyCode = Keys.V Then
             'Do nothing
    End Sub
-----------------------------------------
What I need is when the user press Ctrl+V, nothing will happen. That means the text in Clipboard is not pasted into textbox1.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
Bob LearnedCommented:
e.KeyCode = Keys.None

   or

e.IsInputKey = False

Bob
0
 
PockyMasterCommented:
Yeah, like I said before, use the keydown event
0
 
maidinhtaiAuthor Commented:
TheLearnedOne, where can I put wher
0
 
maidinhtaiAuthor Commented:
TheLearnedOne, where can I put "e.KeyCode = Keys.None" or "e.IsInputKey = False"? If I put it to KeyDown event, so appri's answer is OK.
0
 
Bob LearnedCommented:
In PreviewKeyDown, but appari's answer will work, too.

Bob
0
 
maidinhtaiAuthor Commented:
In the Subroutine that handles  the PreViewKeyDown event, e.KeyCode is readonly, and e.IsInputKey = False seems useless (I mean it does nothing at all). I try changing e.IsInputKey = False to e.IsInputKey = True but there nothing different, too.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.