Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Private Sub Middlewallmove_Tick(sender As Object, e As EventArgs) Handles MiddleWall.Tick
' Move the middle wall ball.

Label4.Location = New Point(Label4.Location.X, Label4.Location.Y + yVel)

' Check for top wall.
If Label4.Location.Y < 0 Then
Label4.Location = New Point(Label4.Location.X, 0)
yVel = -yVel
End If

' Check for bottom wall.
If Label4.Location.Y > Me.Height - Label4.Size.Height - 45 Then

Label4.Location = New Point(Label4.Location.X, Me.Height - Label4.Size.Height - 45)

yVel = -yVel

End If
End Sub



Private Sub Cheeselabel_Tick(sender As Object, e As EventArgs) Handles BottomWallMove.Tick
Label5.Location = New Point(Label5.Location.X + xVel, Label5.Location.Y)

' Check for left wall.
If Label5.Location.X < 619 Then
Label5.Location = New Point(619, Label5.Location.Y)
xVel = -xVel
End If

' Check for bottom wall.
If Label5.Location.X > 724 Then
Label5.Location = New Point(724, Label5.Location.Y)

xVel = -xVel
End If
End Sub
Posted
Comments
Sergey Alexandrovich Kryukov 20-May-15 13:56pm    
If you try to write events and other members you expect an object to have, not those which are actually there, many things won't be found.
What is MiddleWall, a type or an instance?
—SA

1 solution

Check that MiddleWall and BottomWallMove are both Timer class instances - if they aren't, they won't have a Tick event and you will get the error.
I'd suspect that it should be ... Handles MiddleWallMove.Tick, or ... Handles BottomWall.Tick if you have been consistent in your naming.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900