Deskripsi Latihan_07_36110038
Form Latihan_07 terdapat tiga object
yaitu Label, Textbox, dan Button:
Object Label
Terdapat Dua label (yang bertuliskan
masukkan angka dan hasil perhitungan)
Object Text Box
Terdapat tiga puluh textbox (lima
status input; 25 status ReadOnly). Status input digunakan untuk memasukkan
nilai yang diinginkan. Status Read Only digunakan untuk menampilkan hasil
perhitungan dari kelima nilai yang dimasukkan dalam textbox yang berstatus
input dengan menggunakan rumus Suka-suka saya.
Object Button
Terdapat tiga object button (Hitung1,
Hitung2 dan Hitung3). Tombol Hitung digunakan untuk menampilkan hasil
perhitungan di object TextBox ReadOnly. Dimana, jika setiap hitung1, hitung2
dan hitung3 di klik maka rumus dari textbox ke 6, 7, 29, dan 30 sedangkan pada textbox
ke 8-28 memiliki rumus yang sama.
Script Unique
·
Button
"Hitung1" (button1_36110038)
TB06_36110038.Text = (Val(TB01_36110038.Text) * Val(TB02_36110038.Text)) / Val(TB01_36110038.Text)
TB06_36110038.Text = (Val(TB01_36110038.Text) * Val(TB02_36110038.Text)) / Val(TB01_36110038.Text)
·
Button
"Hitung2" (button2_36110038)
TB06_36110038.Text = (Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB01_36110038.Text)
TB06_36110038.Text = (Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB01_36110038.Text)
·
Button
"Hitung3" (button3_36110038)
TB06_36110038.Text = (Val(TB01_36110038.Text) *
Val(TB05_36110038.Text)) / Val(TB01_36110038.Text)
Even
Button1_36110038.Click
Button2_36110038.Click
Button3_36110038.Click
Property
Property
TextBox ==> ReadOnly=True
Prosedur penyelesaian
1. Buka Project_36110038 yang telah
dibuat sebelumnya.
2. Buka visual basic Kumpulan_Latihan_36110038
yang telah dibuat sebelumnya.
3. Buat form baru dengan nama
Latihan_07_36110038 sesuai form dibawah ini.
4. Ganti
nama textbox dan button menggunakan "Properties Window" sesuai dengan
yang diinginkan.
5. Klik
2x pada kotak design untuk membuka lembar VB untuk menuliskan rumusnya. Masukkan
rumus berikut untuk menyelesaikan Latihan_07
Public Class Latihan_07_36110038
Private Sub widhe()
TB08_36110038.Text =
(Val(TB03_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB01_36110038.Text)
TB09_36110038.Text =
(Val(TB04_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB01_36110038.Text)
TB10_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB03_36110038.Text)) / Val(TB01_36110038.Text)
TB11_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB01_36110038.Text)
TB12_36110038.Text = (Val(TB01_36110038.Text)
* Val(TB05_36110038.Text)) / Val(TB01_36110038.Text)
TB13_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB01_36110038.Text)
TB14_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB01_36110038.Text)
TB15_36110038.Text =
(Val(TB03_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB01_36110038.Text)
TB16_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB02_36110038.Text)) / Val(TB02_36110038.Text)
TB17_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB03_36110038.Text)) / Val(TB02_36110038.Text)
TB18_36110038.Text =
(Val(TB03_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB02_36110038.Text)
TB19_36110038.Text =
(Val(TB04_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB02_36110038.Text)
TB20_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB03_36110038.Text)) / Val(TB02_36110038.Text)
TB21_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB02_36110038.Text)
TB22_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB02_36110038.Text)
TB23_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB02_36110038.Text)
TB24_36110038.Text = (Val(TB02_36110038.Text)
* Val(TB05_36110038.Text)) / Val(TB02_36110038.Text)
TB25_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB02_36110038.Text)
TB26_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB02_36110038.Text)) / Val(TB03_36110038.Text)
TB27_36110038.Text =
(Val(TB03_36110038.Text) * Val(TB03_36110038.Text)) / Val(TB03_36110038.Text)
TB28_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB03_36110038.Text)
End Sub
Private Sub
Button1_36110038_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1_36110038.Click
TB06_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB02_36110038.Text)) / Val(TB01_36110038.Text)
TB07_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB03_36110038.Text)) / Val(TB01_36110038.Text)
widhe()
TB29_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB03_36110038.Text)
TB30_36110038.Text =
(Val(TB03_36110038.Text) * Val(TB03_36110038.Text)) / Val(TB03_36110038.Text)
End Sub
Private Sub Button2_36110038_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button2_36110038.Click
TB06_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB01_36110038.Text)
TB07_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB01_36110038.Text)
widhe()
TB29_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB03_36110038.Text)
TB30_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB03_36110038.Text)
End Sub
Private Sub Button3_36110038_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button3_36110038.Click
TB06_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB05_36110038.Text)) / Val(TB01_36110038.Text)
TB07_36110038.Text =
(Val(TB01_36110038.Text) * Val(TB02_36110038.Text)) / Val(TB04_36110038.Text)
widhe()
TB29_36110038.Text =
(Val(TB02_36110038.Text) * Val(TB03_36110038.Text)) / Val(TB04_36110038.Text)
TB30_36110038.Text =
(Val(TB03_36110038.Text) * Val(TB04_36110038.Text)) / Val(TB04_36110038.Text)
End Sub
End Class
6. Tekan
F5 pada keyboard untuk menjalankan form.
Tidak ada komentar:
Posting Komentar