We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

maidinhtai
maidinhtai asked
on
Medium Priority
504 Views
Last Modified: 2008-02-01
The title says all. For example, what is the keychar or keycode of Ctrl+X. Thank you.
Comment
Watch Question

try the following in the keydown event  

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

        End If

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
e.KeyCode = Keys.None

   or

e.IsInputKey = False

Bob
Commented:
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
Yeah, like I said before, use the keydown event

Author

Commented:
TheLearnedOne, where can I put wher

Author

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.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
In PreviewKeyDown, but appari's answer will work, too.

Bob

Author

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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.