hot key

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

    hot key

    ok.. i am using the form keydown event..
    with a select case e.keycode and trying to find when the user puts in ctrl
    + f
    how do i combine an expression to represent this so the keycode will be
    matched in my select statemen?


  • kimiraikkonen

    #2
    Re: hot key

    On Sep 2, 9:06 pm, "Brian" <bsgalla...@com munity.nospamwr ote:
    ok.. i am using the form keydown event..
    with a select case e.keycode and trying to find when the user puts in ctrl
    + f
    how do i combine an expression to represent this so the keycode will be
    matched in my select statemen?
    You can use KeyData instead of KeyCode to combine two keys as follows
    within Select-Case block:

    '-------Begin----------
    Private Sub Form1_KeyDown(B yVal sender As System.Object, _
    ByVal e As System.Windows. Forms.KeyEventA rgs) _
    Handles MyBase.KeyDown
    Select Case e.KeyData
    Case Keys.Control + Keys.F
    ' Implement stuff
    End Select
    End Sub
    '--------End--------

    Hope this works,

    Onur Güzel

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: hot key

      "Brian" <bsgallatin@com munity.nospamsc hrieb:
      ok.. i am using the form keydown event..
      with a select case e.keycode and trying to find when the user puts in
      ctrl + f
      how do i combine an expression to represent this so the keycode will be
      matched in my select statemen?
      \\\
      Private Sub Form1_KeyDown( _
      ByVal sender As Object, _
      ByVal e As KeyEventArgs _
      ) Handles Me.KeyDown
      If _
      e.KeyCode = Keys.F AndAlso _
      CBool(Control.M odifierKeys And Keys.Control) _
      Then
      MsgBox("Hello")
      End If
      End Sub
      ///

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

      Comment

      Working...