Design form menyerupai berikut ini :
Berikut merupakan aktivitas untuk permainan puzzle tersebut.
Private Sub cek()
If (Command1.Caption = “1” And Command2.Caption = “2” And Command3.Caption = “3” And Command4.Caption = “4”) Then
If (Command5.Caption = “5” And Command6.Caption = “6” And Command7.Caption = “7”) Then
If (Command8.Caption = “8”) Then
MsgBox (“Selesai”)
End If
End If
End If
End Sub
Private Sub Command1_Click()
If Command2.Visible = False Then
Command2.Visible = True
Command1.Visible = False
Command2.Caption = Command1.Caption
ElseIf Command4.Visible = False Then
Command4.Visible = True
Command1.Visible = False
Command4.Caption = Command1.Caption
End If
Call cek
End Sub
Private Sub Command2_Click()
If Command1.Visible = False Then
Command1.Visible = True
Command2.Visible = False
Command1.Caption = Command2.Caption
ElseIf Command3.Visible = False Then
Command3.Visible = True
Command2.Visible = False
Command3.Caption = Command2.Caption
ElseIf Command5.Visible = False Then
Command5.Visible = True
Command2.Visible = False
Command5.Caption = Command2.Caption
End If
Call cek
End Sub
Private Sub Command3_Click()
If Command2.Visible = False Then
Command2.Visible = True
Command3.Visible = False
Command2.Caption = Command3.Caption
ElseIf Command6.Visible = False Then
Command6.Visible = True
Command3.Visible = False
Command6.Caption = Command3.Caption
End If
Call cek
End Sub
Private Sub Command4_Click()
If Command1.Visible = False Then
Command1.Visible = True
Command4.Visible = False
Command1.Caption = Command4.Caption
ElseIf Command5.Visible = False Then
Command5.Visible = True
Command4.Visible = False
Command5.Caption = Command4.Caption
ElseIf Command7.Visible = False Then
Command7.Visible = True
Command4.Visible = False
Command7.Caption = Command4.Caption
End If
Call cek
End Sub
Private Sub Command5_Click()
If Command2.Visible = False Then
Command2.Visible = True
Command5.Visible = False
Command2.Caption = Command5.Caption
ElseIf Command4.Visible = False Then
Command4.Visible = True
Command5.Visible = False
Command4.Caption = Command5.Caption
ElseIf Command6.Visible = False Then
Command6.Visible = True
Command5.Visible = False
Command6.Caption = Command5.Caption
ElseIf Command8.Visible = False Then
Command8.Visible = True
Command5.Visible = False
Command8.Caption = Command5.Caption
End If
Call cek
End Sub
Private Sub Command6_Click()
If Command3.Visible = False Then
Command3.Visible = True
Command6.Visible = False
Command3.Caption = Command6.Caption
ElseIf Command9.Visible = False Then
Command9.Visible = True
Command6.Visible = False
Command9.Caption = Command6.Caption
ElseIf Command5.Visible = False Then
Command5.Visible = True
Command6.Visible = False
Command5.Caption = Command6.Caption
End If
Call cek
End Sub
Private Sub Command7_Click()
If Command8.Visible = False Then
Command8.Visible = True
Command7.Visible = False
Command8.Caption = Command7.Caption
ElseIf Command4.Visible = False Then
Command4.Visible = True
Command7.Visible = False
Command4.Caption = Command7.Caption
End If
Call cek
End Sub
Private Sub Command8_Click()
If Command7.Visible = False Then
Command7.Visible = True
Command8.Visible = False
Command7.Caption = Command8.Caption
ElseIf Command9.Visible = False Then
Command9.Visible = True
Command8.Visible = False
Command9.Caption = Command8.Caption
ElseIf Command5.Visible = False Then
Command5.Visible = True
Command8.Visible = False
Command5.Caption = Command8.Caption
End If
Call cek
End Sub
Private Sub Command9_Click()
If Command6.Visible = False Then
Command6.Visible = True
Command9.Visible = False
Command6.Caption = Command9.Caption
ElseIf Command8.Visible = False Then
Command8.Visible = True
Command9.Visible = False
Command8.Caption = Command9.Caption
End If
Call cek
End Sub
Private Sub Acak()
Dim a, c, m, i, y As Byte
Dim x(10) As Byte
For i = 0 To 9
x(i) = i
Next i
a = 4
c = 1
m = 9
x(0) = Rnd(9)
For i = 1 To 9
x(i) = (a * x(i – 1) + c) Mod m
If x(i) = 0 Then
y = i
End If
Next
Command1.Caption = x(0)
Command2.Caption = x(1)
Command3.Caption = x(2)
Command4.Caption = x(3)
Command5.Caption = x(4)
Command6.Caption = x(5)
Command7.Caption = x(6)
Command8.Caption = x(7)
Command9.Caption = x(8)
If y = 1 Then
Command2.Caption = Command1.Caption
Command1.Caption = x(y)
ElseIf y = 2 Then
Command3.Caption = Command1.Caption
Command1.Caption = x(y)
ElseIf y = 3 Then
Command4.Caption = Command1.Caption
Command1.Caption = x(y)
ElseIf y = 4 Then
Command5.Caption = Command1.Caption
Command1.Caption = x(y)
ElseIf y = 5 Then
Command6.Caption = Command1.Caption
Command1.Caption = x(y)
ElseIf y = 6 Then
Command7.Caption = Command1.Caption
Command1.Caption = x(y)
ElseIf y = 7 Then
Command8.Caption = Command1.Caption
Command1.Caption = x(y)
ElseIf y = 8 Then
Command9.Caption = Command1.Caption
Command1.Caption = x(y)
End If
End Sub
Private Sub Form_Load()
Acak
End Sub
Demikianlah aktivitas visual basic membuat puzzle 3 x 3
dalam dunia medispun telah menggunakan system komputasi, berupa aplikasi berbasis desktop maupun under web. kali…
Aplikasi web merupakan salah satu media yang tepat untuk memberikan informasi kepada warga atau masyarakat…
Aplikasi Sistem Informasi Akedemik Sekolah menggunkan PHP MySQl atau berbasis web ini merupakan sebuah sebuah…
Pada kesempatan ini saya kembali membagikan buat anda pencinta aplikasi berbasis web yaitu source kode…
Buat sobat semua yang lagi membutuhkan sedikit pencerahan tentang membuat website sistem pendaftaran online, pada…
Aplikasi Penjualan Sepeda Motor berbasis web ini adalah merupakan aplikasi untuk memberikan kemudahan dalam proses…