Hi
I am currently working on a piece of code that I am struggling to get working.
I have a picture box that I want to move across the screen. At the moment I want it to stop when it gets to a certain point and you have to click next to move it on to the next point.
I have got the first stage to work but the thing that i can't seem to get to work is getting the picture box to move any further. It just stops there
I was wondering if anyone knew how to get it to work.
Public Class Form1
Dim nextcommand As Integer = 7
Dim rewindcommand As Integer = 7
Dim x As Integer = 144
Dim y As Integer = 44
Private Sub NextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextButton.Click
nextcommand = nextcommand - 1
Dim position As New System.Drawing.Point(x, y)
If nextcommand = 6 Then
Fetch.BackColor = Color.LightYellow
PictureBox1.Location = position
Timer1.Interval = 100
Timer1.Start()
ElseIf nextcommand = 5 Then
Fetch.BackColor = Color.DarkSlateGray
Decode.BackColor = Color.LightYellow
' Timer1.Interval = 100
' Timer1.Start()
ElseIf nextcommand = 4 Then
Decode.BackColor = Color.DarkSlateGray
Execute.BackColor = Color.LightYellow
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static count As Integer = 1
If PictureBox1.Location.X < 20 & PictureBox2.Location.X < 20 Then 'if we haven't reached the stopping point
PictureBox1.Left += 5 ' Move the Picturebox 100 units to the right.
Else 'otherwise
Timer1.Enabled = False
' PictureBox1.Hide() ' Disable the timer for this example
End If
If count = 5 Then
Timer1.Enabled = False
End If
count += 1
End Sub
I know I have to set the position of the picturebox and I think I have to read the location of it from the form into some integers. I was wondering if anyone knew how to do this and if I am right?