September 27, 2017
Tugas Vb kedua revisi terbaru
Program ini adalah program pembelian.Terdiri atas 2 form.
Form 1
Di sana ada 7 penyanyi/band di dalam list box.Setiap namanya memiliki case () dalam kurung.Ketika
entry setiap case di checkbox melalui button entrynya, akan muncul harga masing-masing casenya.
Setelah Kita mengetahui semua harga, di button berapa yang harus anda bayar, kita klik muncullah form
2 nya.
Tampilan Form 1
Program ini adalah program pembelian.Terdiri atas 2 form.
Form 1
Di sana ada 7 penyanyi/band di dalam list box.Setiap namanya memiliki case () dalam kurung.Ketika
entry setiap case di checkbox melalui button entrynya, akan muncul harga masing-masing casenya.
Setelah Kita mengetahui semua harga, di button berapa yang harus anda bayar, kita klik muncullah form
2 nya.
Tampilan Form 1
Form2
Pada form 2 ini
Kita akan menginput data belanja
Kita akan memilih salah satu penyanyi/band favorit kita(hanya salah satu)
Untuk fans Secondhand serenade dapat diskon 10%
Untuk fans Jason Miraz dapat diskon 20%
Untuk fans Kesha dapat diskon 7%
Untuk fans Lady dapat diskon 15%
Untuk fans Paramore Ignorance 10%
Untuk fans Owl city 5%
Untuk fans Bruno Mars 15%
Kalau dia bayarnya credit , semua diskonnya dibatalkan
Total Belanja = Harga Bersih
Kalau dia byarnya cash, sesuai dengan prosedur awal
Button exit untuk keluar
Button Data Baru untuk mengosongkan semua text
Source Code Form 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button20.Click
Select Case ComboBox1.Text
Case 1
TextBox1.Text = 1000000
Case 2
TextBox2.Text = 560000
Case 3
TextBox3.Text = 780000
Case 4
TextBox4.Text = 1500000
Case 5
TextBox5.Text = 1500000
Case 6
TextBox6.Text = 900000
Case 7
TextBox7.Text = 870000
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As Integer
For a = 1 To 7
ComboBox2.Items.Add(a)
Next a
End Sub
End Class
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click, Button19.Click
Form2.Show()
End Sub
Source Kode Form 2
Public Class Form2
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox5.Text = 10%
TextBox3.Text = 10 / 100 * TextBox2.Text
TextBox6.Text = " Dapat "
TextBox4.Text = TextBox2.Text - TextBox3.Text
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
TextBox5.Text = 20%
TextBox3.Text = 20 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
TextBox5.Text = 7%
TextBox3.Text = 7 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
If CheckBox4.Checked = True Then
TextBox5.Text = 15%
TextBox3.Text = 15 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
If CheckBox5.Checked = True Then
TextBox5.Text = 10%
TextBox3.Text = 10 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
If CheckBox6.Checked = True Then
TextBox5.Text = 5%
TextBox3.Text = 5 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
If CheckBox7.Checked = True Then
TextBox5.Text = 15%
TextBox3.Text = 15 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
CheckBox7.Checked = False
TextBox5.Text = " "
TextBox4.Text = TextBox2.Text
TextBox6.Text = " Maaf, Anda Tidak Dapat "
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
CheckBox7.Checked = False
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox6.Text = " "
TextBox5.Text = " "
RadioButton1.Checked = False
RadioButton2.Checked = False
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
End Sub
End Class
Pada form 2 ini
Kita akan menginput data belanja
Kita akan memilih salah satu penyanyi/band favorit kita(hanya salah satu)
Untuk fans Secondhand serenade dapat diskon 10%
Untuk fans Jason Miraz dapat diskon 20%
Untuk fans Kesha dapat diskon 7%
Untuk fans Lady dapat diskon 15%
Untuk fans Paramore Ignorance 10%
Untuk fans Owl city 5%
Untuk fans Bruno Mars 15%
Kalau dia bayarnya credit , semua diskonnya dibatalkan
Total Belanja = Harga Bersih
Kalau dia byarnya cash, sesuai dengan prosedur awal
Button exit untuk keluar
Button Data Baru untuk mengosongkan semua text
Source Code Form 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button20.Click
Select Case ComboBox1.Text
Case 1
TextBox1.Text = 1000000
Case 2
TextBox2.Text = 560000
Case 3
TextBox3.Text = 780000
Case 4
TextBox4.Text = 1500000
Case 5
TextBox5.Text = 1500000
Case 6
TextBox6.Text = 900000
Case 7
TextBox7.Text = 870000
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As Integer
For a = 1 To 7
ComboBox2.Items.Add(a)
Next a
End Sub
End Class
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click, Button19.Click
Form2.Show()
End Sub
Source Kode Form 2
Public Class Form2
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox5.Text = 10%
TextBox3.Text = 10 / 100 * TextBox2.Text
TextBox6.Text = " Dapat "
TextBox4.Text = TextBox2.Text - TextBox3.Text
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
TextBox5.Text = 20%
TextBox3.Text = 20 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
TextBox5.Text = 7%
TextBox3.Text = 7 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
If CheckBox4.Checked = True Then
TextBox5.Text = 15%
TextBox3.Text = 15 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
If CheckBox5.Checked = True Then
TextBox5.Text = 10%
TextBox3.Text = 10 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
If CheckBox6.Checked = True Then
TextBox5.Text = 5%
TextBox3.Text = 5 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
If CheckBox7.Checked = True Then
TextBox5.Text = 15%
TextBox3.Text = 15 / 100 * TextBox2.Text
TextBox4.Text = TextBox2.Text - TextBox3.Text
TextBox6.Text = " Dapat "
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
CheckBox7.Checked = False
TextBox5.Text = " "
TextBox4.Text = TextBox2.Text
TextBox6.Text = " Maaf, Anda Tidak Dapat "
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
CheckBox7.Checked = False
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox6.Text = " "
TextBox5.Text = " "
RadioButton1.Checked = False
RadioButton2.Checked = False
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
End Sub
End Class