Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

VB Problem

  1. Oct 16, 2007 #1
    Just have to get a picture box to move around a screen, I'm running the program by a timer. I'll show set integers below.

    Timer = Timer1
    Picture Box = Robot
    Dim Robotpace as integer

    Basically, when you click on the start button it enables the timer. Here's the coding.

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

    RobotPace = 8
    Robot.Left -= RobotPace
    If Robot.Left <= 1 Then
    Robot.Left = False
    Robot.Top -= RobotPace
    If Robot.Top <= 1 Then
    Robot.Top = False
    + Robot.Left += RobotPace
    + If Robot.Left <= 1 Then
    + Robot.Left = False

    End If
    End If

    End Sub

    The lines with the (+'s) at the start of them are the begining of the error. At this point, I'm aware that the timer mistakes the + and - statements in the Robot.Left movements and it completely glitches.

    I just can't fix this.
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted