1. Saat form dijalankan : semua isian tidak aktif, tombol isidata dan tutup aktif, tombol clear tidak aktif
2.Saat ditekan tombol isi data : kodebarang, jumlahbarang, cara beli, tombol clear, aktif, tombol isi data tidak aktif
3.Saat ditekan combol clear sama dengan saat form dijalankan
Berikut coding & hasilnya :
Public Class Form1
Private Sub cmb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb.SelectedIndexChanged
Dim kdbarang, nmbarang As String
Dim harga As Single
kdbarang = cmb.Text
Select Case kdbarang
Case "SPT"
nmbarang = "Sepatu"
harga = 200000
Case "SND"
nmbarang = "Sandal"
harga = 100000
Case "TST"
nmbarang = "T-Shirt"
harga = 1500000
Case "TOP"
nmbarang = "Topi"
harga = 500000
Case Else
nmbarang = "-"
harga = 0
End Select
txtnama.Text = nmbarang
txtharga.Text = harga
txttotal.Text = Val(txtharga.Text) * Val(txtjumlah.Text)
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
If radiotunai.Checked Then
txtdiskon.Text = Val(txttotal.Text) * 10 / 100
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End If
End Sub
Private Sub radiokredit_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiokredit.CheckedChanged
txtdiskon.Text = 0
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End Sub
Private Sub txtjumlah_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtjumlah.TextChanged
txttotal.Text = Val(txtharga.Text) * Val(txtjumlah.Text)
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End Sub
Private Sub radiotunai_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiotunai.CheckedChanged
txtdiskon.Text = Val(txttotal.Text) * 10 / 100
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End Sub
Private Sub btclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btclear.Click
txtbayar.Clear()
txtjumlah.Clear()
txtdiskon.Clear()
txtnama.Clear()
txttotal.Clear()
txtharga.Clear()
cmb.Enabled = False
txtjumlah.Enabled = False
txtnama.Enabled = False
txtharga.Enabled = False
txttotal.Enabled = False
txtdiskon.Enabled = False
txtharga.Enabled = False
radiokredit.Enabled = False
radiotunai.Enabled = False
btclear.Enabled = False
txtbayar.Enabled = False
btisidata.Enabled = True
End Sub
Private Sub bttutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttutup.Click
If MsgBox("Are you serious???", vbYesNo + vbQuestion + vbDefaultButton2, "Keluar") = vbYes Then
Me.Close()
End If
End Sub
Private Sub btisidata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btisidata.Click
cmb.Enabled = True
txtjumlah.Enabled = True
txtnama.Enabled = True
txtharga.Enabled = True
txttotal.Enabled = True
txtdiskon.Enabled = True
txtharga.Enabled = True
radiokredit.Enabled = True
radiotunai.Enabled = True
btclear.Enabled = True
txtbayar.Enabled = True
btisidata.Enabled = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmb.Enabled = False
txtjumlah.Enabled = False
txtnama.Enabled = False
txtharga.Enabled = False
txttotal.Enabled = False
txtdiskon.Enabled = False
txtharga.Enabled = False
radiokredit.Enabled = False
radiotunai.Enabled = False
btclear.Enabled = False
txtbayar.Enabled = False
End Sub
End Class
Program Puzzle.....
Berikut coding dan hasilnya :
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim control As Windows.Forms.Control
For Each control In Me.Controls
If control.GetType.Name = "Button" Then
Dim rndnumber As Random
Dim number As Integer
rndnumber = New Random
number = rndnumber.Next(1, 9)
control.Text = number
If btdua.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btdua.Text = number
Loop Until btdua.Text <> Button1.Text
End If
If bttiga.Text = btdua.Text Or bttiga.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
bttiga.Text = number
Loop Until bttiga.Text <> btdua.Text And bttiga.Text <> btsatu.Text
End If
If btempat.Text = bttiga.Text Or btempat.Text = btdua.Text Or btempat.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btempat.Text = number
Loop Until btempat.Text <> bttiga.Text And btempat.Text <> btdua.Text And btempat.Text <> btsatu.Text
End If
If btempat.Text = bttiga.Text Or btempat.Text = btdua.Text Or btempat.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btempat.Text = number
Loop Until btempat.Text <> bttiga.Text And btempat.Text <> btdua.Text And btempat.Text <> btsatu.Text
End If
If btlima.Text = btempat.Text Or btlima.Text = bttiga.Text Or btlima.Text = btdua.Text Or btlima.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btlima.Text = number
Loop Until btlima.Text <> btempat.Text And btlima.Text <> bttiga.Text And btlima.Text <> btdua.Text And btlima.Text <> btsatu.Text
End If
If btenam.Text = btlima.Text Or btenam.Text = btempat.Text Or btenam.Text = bttiga.Text Or btenam.Text = btdua.Text Or btenam.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btenam.Text = number
Loop Until btenam.Text <> btlima.Text And btenam.Text <> bttiga.Text And btenam.Text <> btdua.Text And btenam.Text <> btsatu.Text
End If
If bttujuh.Text = btenam.Text Or bttujuh.Text = btlima.Text Or bttujuh.Text = btempat.Text Or bttujuh.Text = bttiga.Text Or bttujuh.Text = btdua.Text Or bttujuh.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
bttujuh.Text = number
Loop Until bttujuh.Text <> btenam.Text And bttujuh.Text <> btlima.Text And bttujuh.Text <> btempat.Text And bttujuh.Text <> bttiga.Text And bttujuh.Text <> btdua.Text And bttujuh.Text <> btsatu.Text
End If
If btdelapan.Text = bttujuh.Text Or btdelapan.Text = btenam.Text Or btdelapan.Text = btlima.Text Or btdelapan.Text = btempat.Text Or btdelapan.Text = bttiga.Text Or btdelapan.Text = btdua.Text Or btdelapan.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btdelapan.Text = number
Loop Until btdelapan.Text <> bttujuh.Text And btdelapan.Text <> btenam.Text And btdelapan.Text <> btlima.Text And btdelapan.Text <> btempat.Text And btdelapan.Text <> bttiga.Text And btdelapan.Text <> btdua.Text And btdelapan.Text <> btsatu.Text
End If
End If
btkosong.Text = ""
Next
End Sub
Private Sub btenam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btenam.Click
If btkosong.Text = "" Then
btkosong.Text = btenam.Text
btenam.Text = ""
ElseIf bttiga.Text = "" Then
bttiga.Text = btenam.Text
btenam.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btenam.Text
btenam.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btempat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btempat.Click
If btsatu.Text = "" Then
btsatu.Text = btempat.Text
btempat.Text = ""
ElseIf bttujuh.Text = "" Then
bttujuh.Text = btempat.Text
btempat.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btempat.Text
btempat.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btdua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btdua.Click
If btsatu.Text = "" Then
btsatu.Text = btdua.Text
btdua.Text = ""
ElseIf bttiga.Text = "" Then
bttiga.Text = btdua.Text
btdua.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btdua.Text
btdua.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btdelapan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btdelapan.Click
If bttujuh.Text = "" Then
bttujuh.Text = btdelapan.Text
btdelapan.Text = ""
ElseIf btkosong.Text = "" Then
btkosong.Text = btdelapan.Text
btdelapan.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btdelapan.Text
btdelapan.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btlima_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btlima.Click
If btdua.Text = "" Then
btdua.Text = btlima.Text
btlima.Text = ""
ElseIf btempat.Text = "" Then
btempat.Text = btlima.Text
btlima.Text = ""
ElseIf btenam.Text = "" Then
btenam.Text = btlima.Text
btlima.Text = ""
ElseIf btdelapan.Text = "" Then
btdelapan.Text = btlima.Text
btlima.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub bttiga_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttiga.Click
If btdua.Text = "" Then
btdua.Text = bttiga.Text
bttiga.Text = ""
ElseIf btenam.Text = "" Then
btenam.Text = bttiga.Text
bttiga.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub bttujuh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttujuh.Click
If btempat.Text = "" Then
btempat.Text = bttujuh.Text
bttujuh.Text = ""
ElseIf btdelapan.Text = "" Then
btdelapan.Text = bttujuh.Text
bttujuh.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btkosong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btkosong.Click
If btenam.Text = "" Then
btenam.Text = btkosong.Text
btkosong.Text = ""
ElseIf btdelapan.Text = "" Then
btdelapan.Text = btkosong.Text
btkosong.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btacak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btacak.Click
tmacak.Start()
End Sub
Private Sub tmacak_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmacak.Tick
Dim acak As String
acak = btsatu.Text
btsatu.Text = btdua.Text
btdua.Text = bttiga.Text
bttiga.Text = btempat.Text
btempat.Text = btlima.Text
btlima.Text = btenam.Text
btenam.Text = bttujuh.Text
bttujuh.Text = btdelapan.Text
btdelapan.Text = btkosong.Text
btkosong.Text = acak
End Sub
Private Sub btstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btstop.Click
tmacak.Stop()
End Sub
Private Sub btkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btkeluar.Click
Me.Close()
End Sub
Private Sub btsatu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsatu.Click, btsatu.Click
If btdua.Text = "" Then
btdua.Text = btsatu.Text
btsatu.Text = ""
ElseIf btempat.Text = "" Then
btempat.Text = btsatu.Text
btsatu.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
End Class
Berikut coding & hasilnya :
Public Class Form1
Private Sub cmb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb.SelectedIndexChanged
Dim kdbarang, nmbarang As String
Dim harga As Single
kdbarang = cmb.Text
Select Case kdbarang
Case "SPT"
nmbarang = "Sepatu"
harga = 200000
Case "SND"
nmbarang = "Sandal"
harga = 100000
Case "TST"
nmbarang = "T-Shirt"
harga = 1500000
Case "TOP"
nmbarang = "Topi"
harga = 500000
Case Else
nmbarang = "-"
harga = 0
End Select
txtnama.Text = nmbarang
txtharga.Text = harga
txttotal.Text = Val(txtharga.Text) * Val(txtjumlah.Text)
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
If radiotunai.Checked Then
txtdiskon.Text = Val(txttotal.Text) * 10 / 100
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End If
End Sub
Private Sub radiokredit_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiokredit.CheckedChanged
txtdiskon.Text = 0
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End Sub
Private Sub txtjumlah_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtjumlah.TextChanged
txttotal.Text = Val(txtharga.Text) * Val(txtjumlah.Text)
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End Sub
Private Sub radiotunai_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiotunai.CheckedChanged
txtdiskon.Text = Val(txttotal.Text) * 10 / 100
txtbayar.Text = Val(txttotal.Text) - Val(txtdiskon.Text)
End Sub
Private Sub btclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btclear.Click
txtbayar.Clear()
txtjumlah.Clear()
txtdiskon.Clear()
txtnama.Clear()
txttotal.Clear()
txtharga.Clear()
cmb.Enabled = False
txtjumlah.Enabled = False
txtnama.Enabled = False
txtharga.Enabled = False
txttotal.Enabled = False
txtdiskon.Enabled = False
txtharga.Enabled = False
radiokredit.Enabled = False
radiotunai.Enabled = False
btclear.Enabled = False
txtbayar.Enabled = False
btisidata.Enabled = True
End Sub
Private Sub bttutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttutup.Click
If MsgBox("Are you serious???", vbYesNo + vbQuestion + vbDefaultButton2, "Keluar") = vbYes Then
Me.Close()
End If
End Sub
Private Sub btisidata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btisidata.Click
cmb.Enabled = True
txtjumlah.Enabled = True
txtnama.Enabled = True
txtharga.Enabled = True
txttotal.Enabled = True
txtdiskon.Enabled = True
txtharga.Enabled = True
radiokredit.Enabled = True
radiotunai.Enabled = True
btclear.Enabled = True
txtbayar.Enabled = True
btisidata.Enabled = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmb.Enabled = False
txtjumlah.Enabled = False
txtnama.Enabled = False
txtharga.Enabled = False
txttotal.Enabled = False
txtdiskon.Enabled = False
txtharga.Enabled = False
radiokredit.Enabled = False
radiotunai.Enabled = False
btclear.Enabled = False
txtbayar.Enabled = False
End Sub
End Class
Program Puzzle.....
Berikut coding dan hasilnya :
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim control As Windows.Forms.Control
For Each control In Me.Controls
If control.GetType.Name = "Button" Then
Dim rndnumber As Random
Dim number As Integer
rndnumber = New Random
number = rndnumber.Next(1, 9)
control.Text = number
If btdua.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btdua.Text = number
Loop Until btdua.Text <> Button1.Text
End If
If bttiga.Text = btdua.Text Or bttiga.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
bttiga.Text = number
Loop Until bttiga.Text <> btdua.Text And bttiga.Text <> btsatu.Text
End If
If btempat.Text = bttiga.Text Or btempat.Text = btdua.Text Or btempat.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btempat.Text = number
Loop Until btempat.Text <> bttiga.Text And btempat.Text <> btdua.Text And btempat.Text <> btsatu.Text
End If
If btempat.Text = bttiga.Text Or btempat.Text = btdua.Text Or btempat.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btempat.Text = number
Loop Until btempat.Text <> bttiga.Text And btempat.Text <> btdua.Text And btempat.Text <> btsatu.Text
End If
If btlima.Text = btempat.Text Or btlima.Text = bttiga.Text Or btlima.Text = btdua.Text Or btlima.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btlima.Text = number
Loop Until btlima.Text <> btempat.Text And btlima.Text <> bttiga.Text And btlima.Text <> btdua.Text And btlima.Text <> btsatu.Text
End If
If btenam.Text = btlima.Text Or btenam.Text = btempat.Text Or btenam.Text = bttiga.Text Or btenam.Text = btdua.Text Or btenam.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btenam.Text = number
Loop Until btenam.Text <> btlima.Text And btenam.Text <> bttiga.Text And btenam.Text <> btdua.Text And btenam.Text <> btsatu.Text
End If
If bttujuh.Text = btenam.Text Or bttujuh.Text = btlima.Text Or bttujuh.Text = btempat.Text Or bttujuh.Text = bttiga.Text Or bttujuh.Text = btdua.Text Or bttujuh.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
bttujuh.Text = number
Loop Until bttujuh.Text <> btenam.Text And bttujuh.Text <> btlima.Text And bttujuh.Text <> btempat.Text And bttujuh.Text <> bttiga.Text And bttujuh.Text <> btdua.Text And bttujuh.Text <> btsatu.Text
End If
If btdelapan.Text = bttujuh.Text Or btdelapan.Text = btenam.Text Or btdelapan.Text = btlima.Text Or btdelapan.Text = btempat.Text Or btdelapan.Text = bttiga.Text Or btdelapan.Text = btdua.Text Or btdelapan.Text = btsatu.Text Then
Do
number = rndnumber.Next(1, 9)
btdelapan.Text = number
Loop Until btdelapan.Text <> bttujuh.Text And btdelapan.Text <> btenam.Text And btdelapan.Text <> btlima.Text And btdelapan.Text <> btempat.Text And btdelapan.Text <> bttiga.Text And btdelapan.Text <> btdua.Text And btdelapan.Text <> btsatu.Text
End If
End If
btkosong.Text = ""
Next
End Sub
Private Sub btenam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btenam.Click
If btkosong.Text = "" Then
btkosong.Text = btenam.Text
btenam.Text = ""
ElseIf bttiga.Text = "" Then
bttiga.Text = btenam.Text
btenam.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btenam.Text
btenam.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btempat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btempat.Click
If btsatu.Text = "" Then
btsatu.Text = btempat.Text
btempat.Text = ""
ElseIf bttujuh.Text = "" Then
bttujuh.Text = btempat.Text
btempat.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btempat.Text
btempat.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btdua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btdua.Click
If btsatu.Text = "" Then
btsatu.Text = btdua.Text
btdua.Text = ""
ElseIf bttiga.Text = "" Then
bttiga.Text = btdua.Text
btdua.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btdua.Text
btdua.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btdelapan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btdelapan.Click
If bttujuh.Text = "" Then
bttujuh.Text = btdelapan.Text
btdelapan.Text = ""
ElseIf btkosong.Text = "" Then
btkosong.Text = btdelapan.Text
btdelapan.Text = ""
ElseIf btlima.Text = "" Then
btlima.Text = btdelapan.Text
btdelapan.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btlima_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btlima.Click
If btdua.Text = "" Then
btdua.Text = btlima.Text
btlima.Text = ""
ElseIf btempat.Text = "" Then
btempat.Text = btlima.Text
btlima.Text = ""
ElseIf btenam.Text = "" Then
btenam.Text = btlima.Text
btlima.Text = ""
ElseIf btdelapan.Text = "" Then
btdelapan.Text = btlima.Text
btlima.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub bttiga_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttiga.Click
If btdua.Text = "" Then
btdua.Text = bttiga.Text
bttiga.Text = ""
ElseIf btenam.Text = "" Then
btenam.Text = bttiga.Text
bttiga.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub bttujuh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttujuh.Click
If btempat.Text = "" Then
btempat.Text = bttujuh.Text
bttujuh.Text = ""
ElseIf btdelapan.Text = "" Then
btdelapan.Text = bttujuh.Text
bttujuh.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btkosong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btkosong.Click
If btenam.Text = "" Then
btenam.Text = btkosong.Text
btkosong.Text = ""
ElseIf btdelapan.Text = "" Then
btdelapan.Text = btkosong.Text
btkosong.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
Private Sub btacak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btacak.Click
tmacak.Start()
End Sub
Private Sub tmacak_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmacak.Tick
Dim acak As String
acak = btsatu.Text
btsatu.Text = btdua.Text
btdua.Text = bttiga.Text
bttiga.Text = btempat.Text
btempat.Text = btlima.Text
btlima.Text = btenam.Text
btenam.Text = bttujuh.Text
bttujuh.Text = btdelapan.Text
btdelapan.Text = btkosong.Text
btkosong.Text = acak
End Sub
Private Sub btstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btstop.Click
tmacak.Stop()
End Sub
Private Sub btkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btkeluar.Click
Me.Close()
End Sub
Private Sub btsatu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsatu.Click, btsatu.Click
If btdua.Text = "" Then
btdua.Text = btsatu.Text
btsatu.Text = ""
ElseIf btempat.Text = "" Then
btempat.Text = btsatu.Text
btsatu.Text = ""
End If
If btsatu.Text = "1" And btdua.Text = "2" And bttiga.Text = "3" And btempat.Text = "4" And btlima.Text = "5" And btenam.Text = "6" And bttujuh.Text = "7" And btdelapan.Text = "8" And btkosong.Text = "" Then
MsgBox("Selamat Anda Menang")
End If
End Sub
End Class
Dijalankan otomatis mengacak |
berhenti mengacak dengan menekan tombol stop |
setelah berurutan maka ada tulisan selamat anda menang |
Tidak ada komentar:
Posting Komentar