• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

How to capture a Ctrl-? key combination?

When I need to capture a keypress, I usually use the KeyDown Event of a control and check the e.KeyCode values. I need to capture a key press combination of "Ctrl-Insert". I'm not sure how to do that. Is there a specific ascii value for this combination?

  • 2
1 Solution
Fernando SotoRetiredCommented:
Hi BlakeMcKenna;

Use the KeyDown event and the following code snippet to detect Control + Insert.

Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown

    If e.Modifiers = Keys.Control AndAlso e.KeyCode = Keys.Insert Then
        MessageBox.Show("You have pressed Control + Inset")
    End If

End Sub

Open in new window

BlakeMcKennaAuthor Commented:
Thanks Fernando...
Fernando SotoRetiredCommented:
Not a problem, glad to help.   ;=)
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now