Capturing control keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Capturing control keys

    Hi

    How can I capture control keys Ctrl-A, Ctrl-B, Ctrl-C etc. in a form?

    Thanks

    Regards


  • kimiraikkonen

    #2
    Re: Capturing control keys

    On Apr 21, 12:01 am, "John" <i...@nospam.in fovis.co.ukwrot e:
    Hi
    >
    How can I capture control keys Ctrl-A, Ctrl-B, Ctrl-C etc. in a form?
    >
    Thanks
    >
    Regards
    John,
    First set keypreview property of your form to "True", then:

    Private Sub Form1_keydown(B yVal sender As System.Object, ByVal e As
    System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown
    If e.KeyData = Keys.Control + Keys.A Then
    MsgBox("Ctrl+A pressed")
    ElseIf e.KeyData = Keys.Control + Keys.B Then
    MsgBox("Ctrl+B pressed")
    ElseIf e.KeyData = Keys.Control + Keys.C Then
    MsgBox("Ctrl+C pressed")
    End If

    Hope this helps,

    Onur Güzel
    End Sub

    Comment

    • Cor Ligthert[MVP]

      #3
      Re: Capturing control keys

      \\\
      Private Sub Form1_KeyUp(ByV al sender As Object, _
      ByVal e As System.Windows. Forms.KeyEventA rgs)
      Handles Me.KeyUp
      Dim i = e.KeyData
      End Sub
      ///

      Cor

      "John" <info@nospam.in fovis.co.ukschr eef in bericht
      news:%23bdSomyo IHA.5836@TK2MSF TNGP04.phx.gbl. ..
      Hi
      >
      How can I capture control keys Ctrl-A, Ctrl-B, Ctrl-C etc. in a form?
      >
      Thanks
      >
      Regards
      >

      Comment

      Working...