- Joined
- Jun 4, 2005
- Messages
- 1,656
- Reaction score
- 13
Hey RaGEZONE.
I'm new to Visual Basic for Visual Studio and the whole of Visual Basic itself.
At the moment I've got the follow for this 'picture' to bounce off the left side width and then head back. What i need it to do is to bounce of the right one, and continue this process. But it doesn't. When it goes to the right hand side, it just keeps on going through the side of the screen.
This is the code i have so far.
I'm new to Visual Basic for Visual Studio and the whole of Visual Basic itself.
At the moment I've got the follow for this 'picture' to bounce off the left side width and then head back. What i need it to do is to bounce of the right one, and continue this process. But it doesn't. When it goes to the right hand side, it just keeps on going through the side of the screen.
This is the code i have so far.
Code:
Public Class Form1
Dim z As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
z = 4
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PictureBox1.Left = PictureBox1.Left + z
If PictureBox1.Left + PictureBox1.Width > Me.Width Then z = -z
End Sub
End Class