Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keydown problem - in combination with button 1

Status
Not open for further replies.

vgeng

Technical User
Feb 5, 2003
15
BE
I have the following code which is working fine

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

Select Case e.KeyCode
Case 40
Timer1.Enabled = True
Case 38
Timer2.Enabled = True
Case 37
Timer3.Enabled = True
Case 39
Timer4.Enabled = True
End Select
End Sub


and for example timer1

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim h As Integer

h = (PictureBox1.Location.Y)
h += 1
PictureBox1.Location = New Point(PictureBox1.Location.X, h)

End Sub


But the moment i put a button on my form, the keydown module doesn't react anymore

Anybody an idea why ?

Thx

 
Hi, set the form's KeyPreview Property to True.

woogoo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top