Results 1 to 2 of 2

Thread: System.Windows.Forms.PreviewKeyDownEventArgs [HELP!]

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2016
    Posts
    5

    Question System.Windows.Forms.PreviewKeyDownEventArgs [HELP!]

    Code:
     Private Sub Page1_PreviewKeyDown(sender As Object, e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles Page1.PreviewKeyDown
            Select Case e.KeyCode
                Case Keys.Q
                    My.Computer.Audio.Play(My.Resources.How_are_you, AudioPlayMode.Background)
                 End Select
                 End Sub
    I have this, no errors whatsoever, and originated from my buttons code that worked fine, however I had to click a button for the hotkeys to start working so what I wanted to do was play sounds if the tab was active, yet this code doesn't seem to do anything at all.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,370

    Re: System.Windows.Forms.PreviewKeyDownEventArgs [HELP!]

    Setup a break point on the line that plays the audio, if it doesn't ever get triggered then try setting the KeyPreview to True.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width