Programming for Everybody: October 2019

Source code : Move picture like space ship VB.net

Public Class Form2
    Private slides As Integer
    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        slides += 10
        If slides <= 20 Then
            PictureBox1.Left += 10
        ElseIf slides > 20 AndAlso slides <= 40 Then
            PictureBox1.Top += 10
        ElseIf slides > 40 AndAlso slides <= 60 Then
            PictureBox1.Left -= 10
        ElseIf slides > 60 AndAlso slides <= 80 Then
            PictureBox1.Top -= 10
        Else
            slides = 0
        End If

    End Sub
End Class