I have the following code:
If e.KeyCode.Equals(Keys.A) Then
Button2_KeyDown(Me, e)
My.Computer.Audio.Play("D:\VisualStudio\JuegoDIF\sonidos\sonidoCorrecto.wav")
with this everytime i press the key A then a sound is played
I want to do this same thing but adding another condition, something like:
If e.KeyCode.Equals(Keys.A) and pictureBox1.location = pictureBox2.location Then
Button2_KeyDown(Me, e)
My.Computer.Audio.Play("D:\VisualStudio\JuegoDIF\sonidos\sonidoCorrecto.wav")
so here i'm trying to check if the key A is pressed and also the location of the pictureBox a and 2 is the same then the sound will play.
when i'm trying this implementation there is nothing happening.
How can you do this? or what is wrong with the code?
I have the keypreview property of the form already in True.
Aucun commentaire:
Enregistrer un commentaire