Jumat, 07 Desember 2012

PROGRAM SLOT MACHINE (GAMBAR)


Public Class Form1
    Dim a1, a2, a3 As Integer
-Mendeklarasikan a1, a2, a3 sebagai integer

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        a1 = Int(1 + Rnd() * 6)
        a2 = Int(1 + Rnd() * 6)
        a3 = Int(1 + Rnd() * 6)
        Select Case a1
            Case 1
                PictureBox4.Image = ImageList1.Images.Item(0)
            Case 2
                PictureBox4.Image = ImageList1.Images.Item(1)
            Case 3
                PictureBox4.Image = ImageList1.Images.Item(2)
            Case 4
                PictureBox4.Image = ImageList1.Images.Item(3)
            Case 5
                PictureBox4.Image = ImageList1.Images.Item(4)
            Case 6
                PictureBox4.Image = ImageList1.Images.Item(5)
       
        End Select
        Select Case a2
            Case 1
                PictureBox3.Image = ImageList1.Images.Item(0)
            Case 2
                PictureBox3.Image = ImageList1.Images.Item(1)
            Case 3
                PictureBox3.Image = ImageList1.Images.Item(2)
            Case 4
                PictureBox3.Image = ImageList1.Images.Item(3)
            Case 5
                PictureBox3.Image = ImageList1.Images.Item(4)
            Case 6
                PictureBox3.Image = ImageList1.Images.Item(5)
          
        End Select
        Select Case a3
            Case 1
                PictureBox2.Image = ImageList1.Images.Item(0)
            Case 2
                PictureBox2.Image = ImageList1.Images.Item(1)
            Case 3
                PictureBox2.Image = ImageList1.Images.Item(2)
            Case 4
                PictureBox2.Image = ImageList1.Images.Item(3)
            Case 5
                PictureBox2.Image = ImageList1.Images.Item(4)
            Case 6
                PictureBox2.Image = ImageList1.Images.Item(5)
          
        End Select

    End Sub
-Listing ini yaitu untuk timer dalam mengacak gambar
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = Val(Label1.Text - 1)
        Button1.Enabled = False
        Button2.Enabled = True
        If Label1.Text = 0 Then Button1.Enabled = False
        Timer1.Enabled = True
        PictureBox4.Visible = True
        PictureBox3.Visible = True
        PictureBox2.Visible = True
    End Sub
-Listing ini yaitu untuk mengacak gambar
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
        Button2.Enabled = False
        Button1.Enabled = True
        If (a1 = a2) Or (a1 = a3) Or (a2 = a3) Then
            MessageBox.Show("YOU WIN!")
            Label1.Text = Val(Label1.Text + 1)
        End If

        If Label1.Text = 0 Then
            If MsgBox("One More?", vbQuestion + vbYesNo, "END") = vbYes Then
                Label1.Text = 10
                Button1.Enabled = True
                Button2.Enabled = False
            Else
                Label1.Text = 0
                Button1.Enabled = False
                Button2.Enabled = False
            End If
        End If
    End Sub
-Untuk menghentikan gambar yang diacak
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If MsgBox("Are You Sure?", vbQuestion + vbYesNo, "OUT") = vbYes Then
            End
        Else
            Me.Show()
        End If
    End Sub
-Jika kita mengklik tombol end, maka akan muncul message box
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "SLOT MACHINE"
    End Sub
-Menunjukan nama form
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        MsgBox("klik start untuk mengacak gambar. Lalu tekan tombol stop untuk menghentikan acakan. Anda akan menang apabila anda berhasil menyelesaikan dalam 10 putaran")
    End Sub
-Jika kita mengklik help, maka akan muncul message box berisi cara-cara untuk bermain



PROGRAM SLOT MACHINE (GAMBAR)


Public Class Form1
    Dim a1, a2, a3 As Integer
-Mendeklarasikan a1, a2, a3 sebagai integer

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        a1 = Int(1 + Rnd() * 6)
        a2 = Int(1 + Rnd() * 6)
        a3 = Int(1 + Rnd() * 6)
        Select Case a1
            Case 1
                PictureBox4.Image = ImageList1.Images.Item(0)
            Case 2
                PictureBox4.Image = ImageList1.Images.Item(1)
            Case 3
                PictureBox4.Image = ImageList1.Images.Item(2)
            Case 4
                PictureBox4.Image = ImageList1.Images.Item(3)
            Case 5
                PictureBox4.Image = ImageList1.Images.Item(4)
            Case 6
                PictureBox4.Image = ImageList1.Images.Item(5)
       
        End Select
        Select Case a2
            Case 1
                PictureBox3.Image = ImageList1.Images.Item(0)
            Case 2
                PictureBox3.Image = ImageList1.Images.Item(1)
            Case 3
                PictureBox3.Image = ImageList1.Images.Item(2)
            Case 4
                PictureBox3.Image = ImageList1.Images.Item(3)
            Case 5
                PictureBox3.Image = ImageList1.Images.Item(4)
            Case 6
                PictureBox3.Image = ImageList1.Images.Item(5)
          
        End Select
        Select Case a3
            Case 1
                PictureBox2.Image = ImageList1.Images.Item(0)
            Case 2
                PictureBox2.Image = ImageList1.Images.Item(1)
            Case 3
                PictureBox2.Image = ImageList1.Images.Item(2)
            Case 4
                PictureBox2.Image = ImageList1.Images.Item(3)
            Case 5
                PictureBox2.Image = ImageList1.Images.Item(4)
            Case 6
                PictureBox2.Image = ImageList1.Images.Item(5)
          
        End Select

    End Sub
-Listing ini yaitu untuk timer dalam mengacak gambar
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = Val(Label1.Text - 1)
        Button1.Enabled = False
        Button2.Enabled = True
        If Label1.Text = 0 Then Button1.Enabled = False
        Timer1.Enabled = True
        PictureBox4.Visible = True
        PictureBox3.Visible = True
        PictureBox2.Visible = True
    End Sub
-Listing ini yaitu untuk mengacak gambar
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
        Button2.Enabled = False
        Button1.Enabled = True
        If (a1 = a2) Or (a1 = a3) Or (a2 = a3) Then
            MessageBox.Show("YOU WIN!")
            Label1.Text = Val(Label1.Text + 1)
        End If

        If Label1.Text = 0 Then
            If MsgBox("One More?", vbQuestion + vbYesNo, "END") = vbYes Then
                Label1.Text = 10
                Button1.Enabled = True
                Button2.Enabled = False
            Else
                Label1.Text = 0
                Button1.Enabled = False
                Button2.Enabled = False
            End If
        End If
    End Sub
-Untuk menghentikan gambar yang diacak
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If MsgBox("Are You Sure?", vbQuestion + vbYesNo, "OUT") = vbYes Then
            End
        Else
            Me.Show()
        End If
    End Sub
-Jika kita mengklik tombol end, maka akan muncul message box
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "SLOT MACHINE"
    End Sub
-Menunjukan nama form
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        MsgBox("klik start untuk mengacak gambar. Lalu tekan tombol stop untuk menghentikan acakan. Anda akan menang apabila anda berhasil menyelesaikan dalam 10 putaran")
    End Sub
-Jika kita mengklik help, maka akan muncul message box berisi cara-cara untuk bermain



Program Puzzle Gambar


Analisis Listing Program Puzzle Game
Form 1
Public Class Solve_the_Puzzle
    Dim gambar As Image
    Dim angka As Integer
    Dim Stopwatch As New System.Diagnostics.Stopwatch
Ø  Mendeklarasi gambar sebagai image, angka sebagai integer dan stopwatch sebagai System.Diagnostics.Stopwatch
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
Me.Hide()
End Sub
Ø  Menunjukan apabila tombol start di klik, maka akan pindah ke form2

Form 2

Sub ukuran()
    PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox3.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox4.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox5.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox6.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox7.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox8.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox9.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
Ø  Menyatakan tentang ukuran gambar pada picture box yaitu stretch image

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        If PictureBox2.Image Is Nothing Then
            gambar = PictureBox1.Image
            angka = PictureBox1.Tag
            PictureBox1.Image = PictureBox2.Image
            PictureBox1.Tag = PictureBox2.Tag
            PictureBox2.Image = gambar
            PictureBox2.Tag = angka
        ElseIf PictureBox4.Image Is Nothing Then
            gambar = PictureBox1.Image
            angka = PictureBox1.Tag
            PictureBox1.Image = PictureBox4.Image
            PictureBox1.Tag = PictureBox4.Tag
            PictureBox4.Image = gambar
            PictureBox4.Tag = angka
        End If
        Call ukuran()
    End Sub

    Private Sub PictureBox8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox8.Click
        If PictureBox7.Image Is Nothing Then
            gambar = PictureBox8.Image
            angka = PictureBox8.Tag
            PictureBox8.Image = PictureBox7.Image
            PictureBox8.Tag = PictureBox7.Tag
            PictureBox7.Image = gambar
            PictureBox7.Tag = angka
        ElseIf PictureBox5.Image Is Nothing Then
            gambar = PictureBox8.Image
            angka = PictureBox8.Tag
            PictureBox8.Image = PictureBox5.Image
            PictureBox8.Tag = PictureBox5.Tag
            PictureBox5.Image = gambar
            PictureBox5.Tag = angka
        ElseIf PictureBox9.Image Is Nothing Then
            gambar = PictureBox8.Image
            angka = PictureBox8.Tag
            PictureBox8.Image = PictureBox9.Image
            PictureBox8.Tag = PictureBox9.Tag
            PictureBox9.Image = gambar
            PictureBox9.Tag = angka
        End If
        Call ukuran()
    End Sub
Ø  Menyatakan agar picture box apabila di klik, maka akan terlihat seperti berpindah-pindah pada puzzle. Listing ini berlaku pada picture box lainnya.

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
If PictureBox1.Tag = 1 And PictureBox2.Tag = 2 And PictureBox3.Tag = 3 And PictureBox4.Tag = 4 And PictureBox5.Tag = 5 And PictureBox6.Tag = 6 And PictureBox7.Tag = 7 And PictureBox8.Tag = 8 And PictureBox9.Tag = 9 Then
            MsgBox("Congratulations you WIN!")
            Stopwatch.Stop()
            Form3.Show()
        Else
            MsgBox("Sorry, better luck next time")

        End If
    End Sub
Ø  Menunjukan apabila seluruh picturebox telah sesuai dengan tag-nya masing-masing maka akan menang dan lanjut ke form3, jika tidak akan keluar messagebox

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        gambar = PictureBox9.Image
        angka = PictureBox9.Tag
        PictureBox9.Image = PictureBox4.Image
        PictureBox9.Tag = PictureBox4.Tag
        PictureBox4.Image = gambar
        PictureBox4.Tag = angka

        gambar = PictureBox9.Image
        angka = PictureBox9.Tag
        PictureBox9.Image = PictureBox3.Image
        PictureBox9.Tag = PictureBox3.Tag
        PictureBox3.Image = gambar
        PictureBox3.Tag = angka

        gambar = PictureBox2.Image
        angka = PictureBox2.Tag
        PictureBox2.Image = PictureBox7.Image
        PictureBox2.Tag = PictureBox7.Tag
        PictureBox7.Image = gambar
        PictureBox7.Tag = angka

        gambar = PictureBox2.Image
        angka = PictureBox2.Tag
        PictureBox2.Image = PictureBox6.Image
        PictureBox2.Tag = PictureBox6.Tag
        PictureBox6.Image = gambar
        PictureBox6.Tag = angka

        gambar = PictureBox3.Image
        angka = PictureBox3.Tag
        PictureBox3.Image = PictureBox8.Image
        PictureBox3.Tag = PictureBox8.Tag
        PictureBox8.Image = gambar
        PictureBox8.Tag = angka

        gambar = PictureBox3.Image
        angka = PictureBox3.Tag
        PictureBox3.Image = PictureBox1.Image
        PictureBox3.Tag = PictureBox1.Tag
        PictureBox1.Image = gambar
        PictureBox1.Tag = angka

        gambar = PictureBox5.Image
        angka = PictureBox5.Tag
        PictureBox5.Image = PictureBox8.Image
        PictureBox5.Tag = PictureBox8.Tag
        PictureBox8.Image = gambar
        PictureBox8.Tag = angka

        gambar = PictureBox5.Image
        angka = PictureBox5.Tag
        PictureBox5.Image = PictureBox7.Image
        PictureBox5.Tag = PictureBox7.Tag
        PictureBox7.Image = gambar
        PictureBox7.Tag = angka

        gambar = PictureBox6.Image
        angka = PictureBox6.Tag
        PictureBox6.Image = PictureBox1.Image
        PictureBox6.Tag = PictureBox1.Tag
        PictureBox1.Image = gambar
        PictureBox1.Tag = angka
    End Sub
Ø  Menunjukan untuk mengacak gambar seiring

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        PictureBox1.Visible = True
        PictureBox2.Visible = True
        PictureBox3.Visible = True
        PictureBox4.Visible = True
        PictureBox5.Visible = True
        PictureBox6.Visible = True
        PictureBox7.Visible = True
        PictureBox8.Visible = True
        PictureBox9.Visible = True
    End Sub
Ø  Menunjukan apabila kita mengklik tombol randomize maka akan muncul puzzle-nya

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
        Timer2.Enabled = True
        Stopwatch.Start()
        Label2.Visible = True
    End Sub
Ø  Menunjukan bahwa jika tombol stop diklik, maka Timer1 dihentikan dan timer2 di aktifkan dan dinyatakan pada label2

Sub UpdateDisplay(ByVal ts)
Label2.Text = String.Format("{0:0}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10)

    End Sub
Ø  Menunjukan format penulisan timer pada label2

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If Stopwatch.IsRunning Then
            UpdateDisplay(Stopwatch.Elapsed)
        End If

        Dim waktu As String = "00:08:00"
        If Stopwatch.Elapsed.ToString.Remove(8) = waktu Then
            Stopwatch.Stop()
            Timer2.Stop()
            MsgBox("Time is up, better luck next time :)")
            End

        End If
    End Sub
Ø  Menunjukan jika waktu pada timer telah habis (jangka waktu 8 menit) maka akan muncul messagebox


    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Dim x = MsgBox("Are you sure want to exit?", vbYesNo + vbQuestion)
        If (x = Windows.Forms.DialogResult.No) Then
            Me.Show()
        Else
            Me.Close()
            Solve_the_Puzzle.Close()

        End If
    End Sub
Ø  Menunjukan apabila kita mengklik tombol exit, maka akan muncul messagebox

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.Visible = False
        PictureBox2.Visible = False
        PictureBox3.Visible = False
        PictureBox4.Visible = False
        PictureBox5.Visible = False
        PictureBox6.Visible = False
        PictureBox7.Visible = False
        PictureBox8.Visible = False
        PictureBox9.Visible = False
    End Sub

Ø  Menunjukan apabila saat form2 muncul, maka seluruh picture box disembunyikan terlebih dahulu

Form3

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Clear()
    End Sub
Ø  Menunjukan apabila kita mengklik tombol clear maka textbox akan clear dari tulisan

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form4.Show()
        Me.Hide()

    End Sub
Ø  Menunjukan jika kita mengklik ok maka akan muncul form selanjutnya

Form4

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label2.Text = Form3.TextBox1.Text
    End Sub
Ø  Menunjukan bahwa teks pada label2 sama dengan teks pada textbox1 di form sebelumnya

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.Show()
        Me.Close()

        Form2.Show()
        Me.Hide()


    End Sub
Ø  Menjelaskan bahwa apabila kita mengklik tombol replay, maka akan kembali ke form puzzle

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x = MsgBox("Are you sure want to exit?", vbYesNo + vbQuestion)
        If (x = Windows.Forms.DialogResult.No) Then
            Me.Show()
        Else
            Me.Close()
            Solve_the_Puzzle.Close()
        End If
    End Sub
Ø  Menunjukan apabila kita mengklik tombol exit, maka akan muncul messagebox(yes dan no)Analisis Listing Program Puzzle Game
Form 1
Public Class Solve_the_Puzzle
    Dim gambar As Image
    Dim angka As Integer
    Dim Stopwatch As New System.Diagnostics.Stopwatch
Ø  Mendeklarasi gambar sebagai image, angka sebagai integer dan stopwatch sebagai System.Diagnostics.Stopwatch
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
Me.Hide()
End Sub
Ø  Menunjukan apabila tombol start di klik, maka akan pindah ke form2

Form 2

Sub ukuran()
    PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox3.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox4.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox5.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox6.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox7.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox8.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox9.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
Ø  Menyatakan tentang ukuran gambar pada picture box yaitu stretch image

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        If PictureBox2.Image Is Nothing Then
            gambar = PictureBox1.Image
            angka = PictureBox1.Tag
            PictureBox1.Image = PictureBox2.Image
            PictureBox1.Tag = PictureBox2.Tag
            PictureBox2.Image = gambar
            PictureBox2.Tag = angka
        ElseIf PictureBox4.Image Is Nothing Then
            gambar = PictureBox1.Image
            angka = PictureBox1.Tag
            PictureBox1.Image = PictureBox4.Image
            PictureBox1.Tag = PictureBox4.Tag
            PictureBox4.Image = gambar
            PictureBox4.Tag = angka
        End If
        Call ukuran()
    End Sub

    Private Sub PictureBox8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox8.Click
        If PictureBox7.Image Is Nothing Then
            gambar = PictureBox8.Image
            angka = PictureBox8.Tag
            PictureBox8.Image = PictureBox7.Image
            PictureBox8.Tag = PictureBox7.Tag
            PictureBox7.Image = gambar
            PictureBox7.Tag = angka
        ElseIf PictureBox5.Image Is Nothing Then
            gambar = PictureBox8.Image
            angka = PictureBox8.Tag
            PictureBox8.Image = PictureBox5.Image
            PictureBox8.Tag = PictureBox5.Tag
            PictureBox5.Image = gambar
            PictureBox5.Tag = angka
        ElseIf PictureBox9.Image Is Nothing Then
            gambar = PictureBox8.Image
            angka = PictureBox8.Tag
            PictureBox8.Image = PictureBox9.Image
            PictureBox8.Tag = PictureBox9.Tag
            PictureBox9.Image = gambar
            PictureBox9.Tag = angka
        End If
        Call ukuran()
    End Sub
Ø  Menyatakan agar picture box apabila di klik, maka akan terlihat seperti berpindah-pindah pada puzzle. Listing ini berlaku pada picture box lainnya.

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
If PictureBox1.Tag = 1 And PictureBox2.Tag = 2 And PictureBox3.Tag = 3 And PictureBox4.Tag = 4 And PictureBox5.Tag = 5 And PictureBox6.Tag = 6 And PictureBox7.Tag = 7 And PictureBox8.Tag = 8 And PictureBox9.Tag = 9 Then
            MsgBox("Congratulations you WIN!")
            Stopwatch.Stop()
            Form3.Show()
        Else
            MsgBox("Sorry, better luck next time")

        End If
    End Sub
Ø  Menunjukan apabila seluruh picturebox telah sesuai dengan tag-nya masing-masing maka akan menang dan lanjut ke form3, jika tidak akan keluar messagebox

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        gambar = PictureBox9.Image
        angka = PictureBox9.Tag
        PictureBox9.Image = PictureBox4.Image
        PictureBox9.Tag = PictureBox4.Tag
        PictureBox4.Image = gambar
        PictureBox4.Tag = angka

        gambar = PictureBox9.Image
        angka = PictureBox9.Tag
        PictureBox9.Image = PictureBox3.Image
        PictureBox9.Tag = PictureBox3.Tag
        PictureBox3.Image = gambar
        PictureBox3.Tag = angka

        gambar = PictureBox2.Image
        angka = PictureBox2.Tag
        PictureBox2.Image = PictureBox7.Image
        PictureBox2.Tag = PictureBox7.Tag
        PictureBox7.Image = gambar
        PictureBox7.Tag = angka

        gambar = PictureBox2.Image
        angka = PictureBox2.Tag
        PictureBox2.Image = PictureBox6.Image
        PictureBox2.Tag = PictureBox6.Tag
        PictureBox6.Image = gambar
        PictureBox6.Tag = angka

        gambar = PictureBox3.Image
        angka = PictureBox3.Tag
        PictureBox3.Image = PictureBox8.Image
        PictureBox3.Tag = PictureBox8.Tag
        PictureBox8.Image = gambar
        PictureBox8.Tag = angka

        gambar = PictureBox3.Image
        angka = PictureBox3.Tag
        PictureBox3.Image = PictureBox1.Image
        PictureBox3.Tag = PictureBox1.Tag
        PictureBox1.Image = gambar
        PictureBox1.Tag = angka

        gambar = PictureBox5.Image
        angka = PictureBox5.Tag
        PictureBox5.Image = PictureBox8.Image
        PictureBox5.Tag = PictureBox8.Tag
        PictureBox8.Image = gambar
        PictureBox8.Tag = angka

        gambar = PictureBox5.Image
        angka = PictureBox5.Tag
        PictureBox5.Image = PictureBox7.Image
        PictureBox5.Tag = PictureBox7.Tag
        PictureBox7.Image = gambar
        PictureBox7.Tag = angka

        gambar = PictureBox6.Image
        angka = PictureBox6.Tag
        PictureBox6.Image = PictureBox1.Image
        PictureBox6.Tag = PictureBox1.Tag
        PictureBox1.Image = gambar
        PictureBox1.Tag = angka
    End Sub
Ø  Menunjukan untuk mengacak gambar seiring

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        PictureBox1.Visible = True
        PictureBox2.Visible = True
        PictureBox3.Visible = True
        PictureBox4.Visible = True
        PictureBox5.Visible = True
        PictureBox6.Visible = True
        PictureBox7.Visible = True
        PictureBox8.Visible = True
        PictureBox9.Visible = True
    End Sub
Ø  Menunjukan apabila kita mengklik tombol randomize maka akan muncul puzzle-nya

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
        Timer2.Enabled = True
        Stopwatch.Start()
        Label2.Visible = True
    End Sub
Ø  Menunjukan bahwa jika tombol stop diklik, maka Timer1 dihentikan dan timer2 di aktifkan dan dinyatakan pada label2

Sub UpdateDisplay(ByVal ts)
Label2.Text = String.Format("{0:0}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10)

    End Sub
Ø  Menunjukan format penulisan timer pada label2

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If Stopwatch.IsRunning Then
            UpdateDisplay(Stopwatch.Elapsed)
        End If

        Dim waktu As String = "00:08:00"
        If Stopwatch.Elapsed.ToString.Remove(8) = waktu Then
            Stopwatch.Stop()
            Timer2.Stop()
            MsgBox("Time is up, better luck next time :)")
            End

        End If
    End Sub
Ø  Menunjukan jika waktu pada timer telah habis (jangka waktu 8 menit) maka akan muncul messagebox


    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Dim x = MsgBox("Are you sure want to exit?", vbYesNo + vbQuestion)
        If (x = Windows.Forms.DialogResult.No) Then
            Me.Show()
        Else
            Me.Close()
            Solve_the_Puzzle.Close()

        End If
    End Sub
Ø  Menunjukan apabila kita mengklik tombol exit, maka akan muncul messagebox

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.Visible = False
        PictureBox2.Visible = False
        PictureBox3.Visible = False
        PictureBox4.Visible = False
        PictureBox5.Visible = False
        PictureBox6.Visible = False
        PictureBox7.Visible = False
        PictureBox8.Visible = False
        PictureBox9.Visible = False
    End Sub

Ø  Menunjukan apabila saat form2 muncul, maka seluruh picture box disembunyikan terlebih dahulu

Form3

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Clear()
    End Sub
Ø  Menunjukan apabila kita mengklik tombol clear maka textbox akan clear dari tulisan

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form4.Show()
        Me.Hide()

    End Sub
Ø  Menunjukan jika kita mengklik ok maka akan muncul form selanjutnya

Form4

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label2.Text = Form3.TextBox1.Text
    End Sub
Ø  Menunjukan bahwa teks pada label2 sama dengan teks pada textbox1 di form sebelumnya

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.Show()
        Me.Close()

        Form2.Show()
        Me.Hide()


    End Sub
Ø  Menjelaskan bahwa apabila kita mengklik tombol replay, maka akan kembali ke form puzzle

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x = MsgBox("Are you sure want to exit?", vbYesNo + vbQuestion)
        If (x = Windows.Forms.DialogResult.No) Then
            Me.Show()
        Else
            Me.Close()
            Solve_the_Puzzle.Close()
        End If
    End Sub
Ø  Menunjukan apabila kita mengklik tombol exit, maka akan muncul messagebox(yes dan no)

  FLOWCHART