I have a pong type of game and I want the spacebar to pause the game... Here is my code to detect when the space bar is pressed.
Private Sub PongMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyValue = Keys.Space Then
            Application.Exit()
        End If
    End Sub
For some reason the application is not closing... IS 开发者_运维百科there something wrong with this code that I am not seeing?
Thanks
Make sure to check your form's KeyPreview property.
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.keypreview.aspx
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论