HELP GUSY! I can't get my key press even to work. I want to have a key press event where when I press spacebar, I will perform some things.
Here is my code:
Private Sub gamePlay_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = "32" Then
// perform code here
End If
End Sub
I search the internet saying that keycharis looking for the value of a certain key that is pressed. I got 32 for spacebar. My code is not working at all. Is there something wrong with my condition or approach? Or is there other ways to do that?
Thanks!
Here is my code:
Private Sub gamePlay_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = "32" Then
// perform code here
End If
End Sub
I search the internet saying that keycharis looking for the value of a certain key that is pressed. I got 32 for spacebar. My code is not working at all. Is there something wrong with my condition or approach? Or is there other ways to do that?
Thanks!