MODIFIKASI PROGRAM
- Pertama-tama saya buat form terlebih dahulu. Langsung saja gambar form di bawah ini :
Setelah itu saya buat codingnya,, codingnya seperti dibawah ini :
PublicClassForm1
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
ForEach isi InMe.Controls
isi.Enabled = False
Btisidata.enabled = True
Bttutup.enabled = True
Next
cmbcode.Items.Add(“SPT”)
cmbcode.Items.Add(“SND”)
cmbcode.Items.Add(“TST”)
cmbcode.Items.Add(“TOP”)
cmbcode.Items.Add(“TAS”)
EndSub
PrivateSub cmbcode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbcode.SelectedIndexChanged
Dim kdbarang, namabarang AsString
Dim harga AsSingle
kdbarang = cmbcode.Text
SelectCase kdbarang
Case”SPT”
namabarang = “Sepatu”
harga = 200000
Case”SND”
namabarang = “Sandal”
harga = 100000
Case”TST”
namabarang = “T-Shirt”
harga = 150000
Case”TOP”
namabarang = “Topi”
harga = 500000
Case”TAS”
namabarang = “Tas”
harga = 250000
Case Else
namabarang = “-”
harga = 0
EndSelect
txtnama.Text = namabarang
txtharga.Text = harga
EndSub
PrivateSub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiotunai.CheckedChanged
txtdiskon.Text = Val(txtbayar.Text) * 10 / 100
txtbayar.Text = Val(txttotal.Text) – Val(txtdiskon.Text)
EndSub
PrivateSub RadioButton2_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)
EndSub
PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ForEach isi InMe.Controls
isi.Enabled = False
btisidata.Enabled = True
bttutup.Enabled = True
Next
txtbayar.Clear()
txtdiskon.Clear()
txtharga.Clear()
txtjumlah.Clear()
txtnama.Clear()
txttotal.Clear()
Me.radiotunai.Checked = False
Me.radiokredit.Checked = False
cmbcode.Text = “”
EndSub
PrivateSub bttutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttutup.Click
Me.Close()
EndSub
PrivateSub btisidata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btisidata.Click
ForEach isi InMe.Controls
isi.Enabled = True
btisidata.Enabled = False
txtharga.Enabled = False
txtnama.Enabled = False
txttotal.Enabled = False
txtdiskon.Enabled = False
txtbayar.Enabled = False
Next
EndSub
EndClass
Setelah saya buat codingnya lalu saya run agar program berjalan, dan setelah di modifikasi saya run maka gambar yang terlihat tombol clear dan menu menjadi mati dan gambarnya dibawah ini :
Setelah itu saya click button ISI DATA maka akan terlihat gambar dibawah ini :
Puzzle Sederhana
Pertama saya buat form terlebih dahulu,, dan saya isikan 9 tombol button lalu saya ubah menjadi angka dan di urutkan, maka form awal telah jadi seperti dibawah ini :
Setelah form jadi , saya buat codingnya dan codingnya dibawah ini :
PublicClassForm1
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim control As Windows.Forms.Control
ForEach control InMe.Controls
If control.GetType.Name = “Button”Then
Dim rndnumber AsRandom
Dim number AsInteger
rndnumber = NewRandom
number = rndnumber.Next(1, 9)
control.Text = number
If Button2.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button2.Text = number
LoopUntil Button2.Text <> Button1.Text
EndIf
If Button3.Text = Button2.Text Or Button3.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button3.Text = number
LoopUntil Button3.Text <> Button2.Text And Button3.Text <> Button1.Text
EndIf
If Button4.Text = Button3.Text Or Button4.Text = Button2.Text Or Button4.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button4.Text = number
LoopUntil Button4.Text <> Button3.Text And Button4.Text <> Button2.Text And Button4.Text <> Button1.Text
EndIf
If Button4.Text = Button3.Text Or Button4.Text = Button2.Text Or Button4.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button4.Text = number
LoopUntil Button4.Text <> Button3.Text And Button4.Text <> Button2.Text And Button4.Text <> Button1.Text
EndIf
If Button5.Text = Button4.Text Or Button5.Text = Button3.Text Or Button5.Text = Button2.Text Or Button5.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button5.Text = number
LoopUntil Button5.Text <> Button4.Text And Button5.Text <> Button3.Text And Button5.Text <> Button2.Text And Button5.Text <> Button1.Text
EndIf
If Button6.Text = Button5.Text Or Button6.Text = Button4.Text Or Button6.Text = Button3.Text Or Button6.Text = Button2.Text Or Button6.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button6.Text = number
LoopUntil Button6.Text <> Button5.Text And Button6.Text <> Button3.Text And Button6.Text <> Button2.Text And Button6.Text <> Button1.Text
EndIf
If Button7.Text = Button6.Text Or Button7.Text = Button5.Text Or Button7.Text = Button4.Text Or Button7.Text = Button3.Text Or Button7.Text = Button2.Text Or Button7.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button7.Text = number
LoopUntil Button7.Text <> Button6.Text And Button7.Text <> Button5.Text And Button7.Text <> Button4.Text And Button7.Text <> Button3.Text And Button7.Text <> Button2.Text And Button7.Text <> Button1.Text
EndIf
If Button8.Text = Button7.Text Or Button8.Text = Button6.Text Or Button8.Text = Button5.Text Or Button8.Text = Button4.Text Or Button8.Text = Button3.Text Or Button8.Text = Button2.Text Or Button8.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button8.Text = number
LoopUntil Button8.Text <> Button7.Text And Button8.Text <> Button6.Text And Button8.Text <> Button5.Text And Button8.Text <> Button4.Text And Button8.Text <> Button3.Text And Button8.Text <> Button2.Text And Button8.Text <> Button1.Text
EndIf
EndIf
Button9.Text = “”
Next
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button2.Text = “”Then
Button2.Text = Button1.Text
Button1.Text = “”
ElseIf Button4.Text = “”Then
Button4.Text = Button1.Text
Button1.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button1.Text = “”Then
Button1.Text = Button2.Text
Button2.Text = “”
ElseIf Button3.Text = “”Then
Button3.Text = Button2.Text
Button2.Text = “”
ElseIf Button5.Text = “”Then
Button5.Text = Button2.Text
Button2.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button2.Text = “”Then
Button2.Text = Button3.Text
Button3.Text = “”
ElseIf Button6.Text = “”Then
Button6.Text = Button3.Text
Button3.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Button1.Text = “”Then
Button1.Text = Button4.Text
Button4.Text = “”
ElseIf Button7.Text = “”Then
Button7.Text = Button4.Text
Button4.Text = “”
ElseIf Button5.Text = “”Then
Button5.Text = Button4.Text
Button4.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If Button2.Text = “”Then
Button2.Text = Button5.Text
Button5.Text = “”
ElseIf Button4.Text = “”Then
Button4.Text = Button5.Text
Button5.Text = “”
ElseIf Button6.Text = “”Then
Button6.Text = Button5.Text
Button5.Text = “”
ElseIf Button8.Text = “”Then
Button8.Text = Button5.Text
Button5.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If Button9.Text = “”Then
Button9.Text = Button6.Text
Button6.Text = “”
ElseIf Button3.Text = “”Then
Button3.Text = Button6.Text
Button6.Text = “”
ElseIf Button5.Text = “”Then
Button5.Text = Button6.Text
Button6.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If Button4.Text = “”Then
Button4.Text = Button7.Text
Button7.Text = “”
ElseIf Button8.Text = “”Then
Button8.Text = Button7.Text
Button7.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If Button7.Text = “”Then
Button7.Text = Button8.Text
Button8.Text = “”
ElseIf Button9.Text = “”Then
Button9.Text = Button8.Text
Button8.Text = “”
ElseIf Button5.Text = “”Then
Button5.Text = Button8.Text
Button8.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
PrivateSub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If Button6.Text = “”Then
Button6.Text = Button9.Text
Button9.Text = “”
ElseIf Button8.Text = “”Then
Button8.Text = Button9.Text
Button9.Text = “”
EndIf
If Button1.Text = “1”And Button2.Text = “2”And Button3.Text = “3”And Button4.Text = “4”And Button5.Text = “5”And Button6.Text = “6”And Button7.Text = “7”And Button8.Text = “8”And Button9.Text = “”Then
MsgBox(“Anda Pintar”)
EndIf
EndSub
EndClass
Setelah saya buat codingnya lalu saya run agar program berjalan, lalu setelah saya run puzzle akan menjadi acak, dan gambarnya seperti dibawah ini :
Lalu mulailah untuk bermain puzzle supaya angka-angka menjadi urut dan bermain puzzle itu membutuhkan kelihaian ataupun kecerdasan untuk membuat puzzle itu menjadi urut, setelah saya bermain puzzle dan lumayan lama juga untuk menjadikan urut,, hehe maklum lama ga main puzzle,, maka selesailah bermain puzzle, puzzle telah urut dan muncul anda pintar, gambarnya seperti dibawah ini :
Akhirnya selesailah sudah, dengan semangat membuat maka tugas menjadi selesai, sekian TERIMA KASIH