"TEKNIK INFORMATIKA-09"

.
Diberdayakan oleh Blogger.

Tugas VB.Net

Cara membuat fuzzle sederhana menggunakan VB.Net 

Buatlah form seperti dibawah ini.


Setelah selesai membuat form diatas,lalu masukanlah soure code seperti yang dibawah ini : 
Public Class Form1
    Dim x As Integer = 0
    Dim w As String
    Dim y As Button

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If  x = 0  Then
            w = Button1.Text
            y = Button1
            x = 1

        Else
            y.Text = Button1.Text
            Button1.Text =  w
            x  =  0
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If  x = 0 Then
            w = Button2.Text
            y = Button2
            x = 1
        Else
            y.Text = Button2.Text
            Button2.Text = w
            x = 0
        End If
    End Sub

  
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Clickk
        If  x = 0 Then
            w = Button3.Text
            y = Button3
            x = 1
        Else
            y.Text = Button3.Text
            Button3.Text = w
            x = 0
        End If
    End Sub

   
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If  x = 0 Then
            w = Button4.Text
            y = Button4
            x = 1
        Else
            y.Text = Button4.Text
            Button4.Text = w
            x = 0
        End If
    End Sub

  
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If  x = 0 Then
            w = Button5.Text
            y = Button5
            x = 1
        Else
            y.Text = Button5.Text
            Button5.Text = w
            x = 0
        End If
    End Sub

 
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If  x = 0 Then
            w = Button6.Text
            y = Button6
            x = 1
        Else
            y.Text = Button6.Text
            Button6.Text = w
            x = 0
        End If
    End Sub

   
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        If  x = 0 Then
            w = Button7.Text
            y = Button7
            x = 1
        Else
            y.Text = Button7.Text
            Button7.Text = w
            x = 0
        End If
    End Sub

  
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        If  x = 0 Then
            w = Button8.Text
            y = Button8
            x = 1
        Else
            y.Text = Button8.Text
            Button8.Text = w
            x = 0
        End If
    End Sub

  
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        If  x = 0 Then
            w = Button9.Text
            y = Button9
            x = 1
        Else
            y.Text = Button9.Text
            Button9.Text = w
            x = 0
        End If
    End Sub
End Class



Setelah selesai, dan apabila kita running / jalankan maka hasilnya apabila telah kita susun,akan seperti gambar dibawah ini :

  
 Semoga Bermanfaat.....