Deskripsi Latihan_06_36110038
Form Latihan_06 terdapat empat
object yaitu Label, Textbox, CheckBox, dan RadioButton:
Object Label
Terdapat tujuh label (yang
bertuliskan Makanan Khas Makassar; Makanan; Harga; Qty; Jumlah; Total; Jumlah
Bersih)
Object Text Box
Terdapat dua puluh satu textbox dengan
status readonly=true yang digunakan untuk memasukkan nilai Harga dari keenam
jenis makanan; Qty dari keenam jenis makanan; Jumlah harga dari keenam jenis
makanan; Total harga; Potongan yang diberikan; Jumlah Bersih dari total harga
dikurangi potongan. Dua belas diantaranya (Harga dari keenam jenis makanan dan Qty
dari keenam jenis makanan) akan berubah status menjadi readonly=false jika
object checkbox di checklist(v).
Object CheckBoxt
Terdapat enam object CheckBox (Coto,
Pallubasa, Sop Konro, Sop Saudara, Konro Bakar, dan Ulu Juku’). Object
CheckBoxt digunakan agar Harga dari keenam jenis makanan dan Qty dari keenam
jenis makanan dapat berubah status menjadi readonly=false oleh karena itu
textbox tersebut nilainya sudah dapat dimasukkan.
Object RadioButton
Terdapat dua object RadioButton (Pot.Member10%
dan Non Member). RadioButton Pot.Member10% digunakan untuk menampilkan potongan
yang terjadi yaitu 10% dari Total. Sedangakn RadioButton Non Member digunakan
jika tidak ada potongan yang diberikan.
Script Unique
·
CheckBox
"Coto" (coto_36110038)
If coto_36110038.Checked Then
If coto_36110038.Checked Then
hrg1_36110038.ReadOnly = False
qty1_36110038.ReadOnly = False
Else
hrg1_36110038.ReadOnly = True
qty1_36110038.ReadOnly = True
End If
·
RadioButton
"Pot.Member10%" (pm_36110038)
If pm_36110038.Checked Then
If pm_36110038.Checked Then
pot_36110038.Text = Val(total_36110038.Text) * (10 / 100)
bersih_36110038.Text = Val(total_36110038.Text) - Val(pot_36110038.Text)
End If
Even
coto_36110038.CheckedChanged
pallubasa_36110038.CheckedChanged
sopkon_36110038.CheckedChanged
sopsau_36110038.CheckedChanged
koba_36110038.CheckedChanged
ulu_36110038.CheckedChanged
pm_36110038.CheckedChanged
nm_36110038.CheckedChanged
Property
Property
TextBox ==> ReadOnly=True
Prosedur penyelesaian
1.klik
star lalu pilih Microsoft Visual Studio 2008
2.
pilih file => new => project
3.
isi name dan location pada kolom yang disiapkan lalu OK
4. buat form dengan menggunakan Label, Textbox, dan Button yang ada
dalam "Toolbox
5. ganti nama textbox dan button menggunakan "Properties
Window"
6. Klik 2x pada
kotak design untuk membuka lembar vb
Masukkan rumus berikut untuk menyelesaikan latihan_06
Masukkan rumus berikut untuk menyelesaikan latihan_06
Public Class Latihan_06_36110038
Private Sub jml1_36110038_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles jml1_36110038.TextChanged
End Sub
Private Sub coto_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
coto_36110038.CheckedChanged
If
coto_36110038.Checked Then
hrg1_36110038.ReadOnly = False
qty1_36110038.ReadOnly = False
Else
hrg1_36110038.ReadOnly = True
qty1_36110038.ReadOnly = True
End If
End Sub
Private Sub Pallubasa_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Pallubasa_36110038.CheckedChanged
If
pallubasa_36110038.Checked Then
hrg2_36110038.ReadOnly = False
qty2_36110038.ReadOnly = False
Else
hrg2_36110038.ReadOnly = True
qty2_36110038.ReadOnly = True
End If
End Sub
Private Sub sopkon_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
sopkon_36110038.CheckedChanged
If
sopkon_36110038.Checked Then
hrg3_36110038.ReadOnly = False
qty3_36110038.ReadOnly = False
Else
hrg3_36110038.ReadOnly = True
qty3_36110038.ReadOnly = True
End If
End Sub
Private Sub Sopsau_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Sopsau_36110038.CheckedChanged
If
Sopsau_36110038.Checked Then
hrg4_36110038.ReadOnly = False
qty4_36110038.ReadOnly = False
Else
hrg4_36110038.ReadOnly = True
qty4_36110038.ReadOnly = True
End If
End Sub
Private Sub koba_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
koba_36110038.CheckedChanged
If
koba_36110038.Checked Then
hrg5_36110038.ReadOnly = False
qty5_36110038.ReadOnly = False
Else
hrg5_36110038.ReadOnly = True
qty5_36110038.ReadOnly = True
End If
End Sub
Private Sub ulu_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
ulu_36110038.CheckedChanged
If
ulu_36110038.Checked Then
hrg6_36110038.ReadOnly = False
qty6_36110038.ReadOnly = False
Else
hrg6_36110038.ReadOnly = True
qty6_36110038.ReadOnly = True
End If
End Sub
Private Sub qty1_36110038_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
qty1_36110038.TextChanged
jml1_36110038.Text =
Val(hrg1_36110038.Text) * Val(qty1_36110038.Text)
total_36110038.Text =
Val(jml1_36110038.Text) + Val(jml2_36110038.Text) + Val(jml3_36110038.Text) +
Val(jml4_36110038.Text) + Val(jml5_36110038.Text) + Val(jml6_36110038.Text)
End Sub
Private Sub qty2_36110038_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
qty2_36110038.TextChanged
jml2_36110038.Text =
Val(hrg2_36110038.Text) * Val(qty2_36110038.Text)
total_36110038.Text =
Val(jml1_36110038.Text) + Val(jml2_36110038.Text) + Val(jml3_36110038.Text) +
Val(jml4_36110038.Text) + Val(jml5_36110038.Text) + Val(jml6_36110038.Text)
End Sub
Private Sub qty3_36110038_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
qty3_36110038.TextChanged
jml3_36110038.Text =
Val(hrg3_36110038.Text) * Val(qty3_36110038.Text)
total_36110038.Text =
Val(jml1_36110038.Text) + Val(jml2_36110038.Text) + Val(jml3_36110038.Text) +
Val(jml4_36110038.Text) + Val(jml5_36110038.Text) + Val(jml6_36110038.Text)
End Sub
Private Sub qty4_36110038_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
qty4_36110038.TextChanged
jml4_36110038.Text = Val(hrg4_36110038.Text)
* Val(qty4_36110038.Text)
total_36110038.Text =
Val(jml1_36110038.Text) + Val(jml2_36110038.Text) + Val(jml3_36110038.Text) +
Val(jml4_36110038.Text) + Val(jml5_36110038.Text) + Val(jml6_36110038.Text)
End Sub
Private Sub qty5_36110038_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
qty5_36110038.TextChanged
jml5_36110038.Text =
Val(hrg5_36110038.Text) * Val(qty5_36110038.Text)
total_36110038.Text =
Val(jml1_36110038.Text) + Val(jml2_36110038.Text) + Val(jml3_36110038.Text) +
Val(jml4_36110038.Text) + Val(jml5_36110038.Text) + Val(jml6_36110038.Text)
End Sub
Private Sub qty6_36110038_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
qty6_36110038.TextChanged
jml6_36110038.Text =
Val(hrg6_36110038.Text) * Val(qty6_36110038.Text)
total_36110038.Text =
Val(jml1_36110038.Text) + Val(jml2_36110038.Text) + Val(jml3_36110038.Text) +
Val(jml4_36110038.Text) + Val(jml5_36110038.Text) + Val(jml6_36110038.Text)
End Sub
Private Sub pm_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
pm_36110038.CheckedChanged
If
pm_36110038.Checked Then
pot_36110038.Text = Val(total_36110038.Text)
* (10 / 100)
bersih_36110038.Text =
Val(total_36110038.Text) - Val(pot_36110038.Text)
End If
End Sub
Private Sub nm_36110038_CheckedChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
nm_36110038.CheckedChanged
If
nm_36110038.Checked Then
pot_36110038.Text = 0
bersih_36110038.Text =
Val(total_36110038.Text) - Val(pot_36110038.Text)
End If
End Sub
End Class
7. Tekan F5 pada
keyboard untuk menjalankan form.
Tidak ada komentar:
Posting Komentar