A. Langkah-Langkah Penyelesaian Form Latihan_14
· Buka project yang telah dibuat sebelumnya.
· Click project kemudian pilih add windows form, seperti pada gambar dibawah ini
· Ketik nama form
"Latihan_14_46110007" pada name kemudian click add
· Buat form seperti berikut
*object yang digunakan
·
Setelah
itu beri teks pada label, group box, radiobutton, textbox (pengganti label) dan
button
·
Kemudian
beri nama pada semua objek, kecuali label
· Setelah form selesai masukkan rumus seperti
dibawah ini
Public Class
Latihan_14_46110007
Dim DTMABA As New DataTable
Dim DV As New DataView
Private Sub Latihan_14_46110007_Load(ByVal
sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DTMABA.Columns.Add(New DataColumn("STAMBUK",
GetType(String)))
DTMABA.Columns.Add(New DataColumn("NAMA",
GetType(String)))
DTMABA.Columns.Add(New DataColumn("JENIS
KELAMIN", GetType(String)))
DTMABA.Columns.Add(New DataColumn("TANGGAL
LAHIR", GetType(String)))
DTMABA.Columns.Add(New DataColumn("GAJI
ORTU", GetType(Double)))
DTMABA.Columns.Add(New DataColumn("KELAS",
GetType(String)))
DTMABA.Rows.Add("46112003", "Nurawalia
M", "P", "12/04/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46120023", "Puspita
Susilawati Ridjal", "P", "01/01/1994", 4000000, "1AD4")
DTMABA.Rows.Add("46110018", "Rose
Anne Tarida Situmorang", "P", "12/01/1994", 5000000, "1AD4")
DTMABA.Rows.Add("46112004", "Siti
Khaerunnisa", "P", "03/28/1994", 1000000, "1AD4")
DTMABA.Rows.Add("46112015", "Irmayanti",
"P", "09/23/1994", 1000000, "1AD4")
DTMABA.Rows.Add("46112011", "Delsi
Tifani Lan", "P", "12/24/1994", 2000000, "1AD4")
DTMABA.Rows.Add("46112027", "Reny
Rita Waty Djafar", "P", "07/26/1993", 3000000, "1AD4")
DTMABA.Rows.Add("46112002", "Dewi
Sartika", "P", "02/10/1994", 1000000, "1AD4")
DTMABA.Rows.Add("46112004", "Anita
Rahmah Muhtadin", "P", "12/07/1994", 5000000, "1AD4")
DTMABA.Rows.Add("46112021", "Rafidah",
"P", "06/05/1994", 500000, "1AD4")
DTMABA.Rows.Add("46112009", "Eka
Yuli Astuti", "P", "08/07/1994", 2000000, "1AD4")
DTMABA.Rows.Add("46112025", "Fitri
Amalia Islamiati", "P", "03/26/1995", 4000000, "1AD4")
DTMABA.Rows.Add("46112014", "Mariana",
"P", "06/22/1994", 1000000, "1AD4")
DTMABA.Rows.Add("46112013", "A.
Muh. Lutfi Ahmad", "L", "10/10/1993", 4000000, "1AD4")
DTMABA.Rows.Add("46112008", "Nanda
Ardilia Pratama", "L", "08/01/1994", 1000000, "1AD4")
DTMABA.Rows.Add("46112022", "Liliani
Paelongan", "P", "05/25/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46112007", "Andi
Rabiah", "L", "09/07/1994", 1000000, "1AD4")
DTMABA.Rows.Add("46112001", "Rizka
Awalia Mustakim", "P", "10/07/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46112005", "Mardhotillah",
"P", "01/13/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46112017", "Camelia
Indulgenssya Gundung", "P", "09/14/1994", 2000000, "1AD4")
DTMABA.Rows.Add("46112028", "Nur
Salim Rusdi", "L", "04/12/1994", 1500000, "1AD4")
DTMABA.Rows.Add("46112026", "Muhammad
Khaidir", "L", "12/26/1993", 3000000, "1AD4")
DTMABA.Rows.Add("46112020", "Sukriani
Karunia Rahma", "P", "12/01/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46112006", "Rezky
Tri Utami", "P", "07/03/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46112029", "Azwar
Arfah", "L", "04/03/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46112016", "Dyah
Sukma Anggraini", "P", "05/10/1994", 3500000, "1AD4")
DTMABA.Rows.Add("46112010", "Nur
Indah Purnamasari", "P", "07/22/1994", 2500000, "1AD4")
DTMABA.Rows.Add("46112012", "Nurul
Qadri Musra", "L", "08/24/1994", 3000000, "1AD4")
DTMABA.Rows.Add("46112055", "Reni
Anggraeni", "P", "10/12/1994", 1500000, "1BD4")
DTMABA.Rows.Add("46112042", "Faradhiba
Zainal Putri", "P", "12/04/1993", 3000000, "1BD4")
DTMABA.Rows.Add("46112054", "Rahmi
Ani", "P", "11/30/1994", 2000000, "1BD4")
DTMABA.Rows.Add("46112043", "Remon
Agit Rimang", "L", "01/06/1995", 3000000, "1BD4")
DTMABA.Rows.Add("46112032", "Abd.
Rahman", "L", "10/08/1994", 1500000, "1BD4")
DTMABA.Rows.Add("46112057", "I
Ketut Yuda Sadpwa", "L", "05/02/1993", 4500000, "1BD4")
DTMABA.Rows.Add("46112037", "Herianto",
"L", "12/08/1993", 3000000, "1BD4")
DTMABA.Rows.Add("46112058", "citra
amalia ramadhani", "L", "02/16/1995", 3000000, "1BD4")
DTMABA.Rows.Add("46112050", "Andi
Akbar", "L", "11/26/1994", 2000000, "1BD4")
DTMABA.Rows.Add("46112034", "Gamaliel
Giovani Rafael Nong", "L", "08/06/1993", 3700000, "1BD4")
DTMABA.Rows.Add("46112047", "Hasmawati",
"P", "11/22/1994", 5000000, "1BD4")
DTMABA.Rows.Add("46112038", "Viorensi
S", "P", "10/13/1994", 2000000, "1BD4")
DTMABA.Rows.Add("46112046", "Andini
Hayrunnisyah", "P", "06/27/1994", 1500000, "1BD4")
DTMABA.Rows.Add("46112031", "Irmayanti",
"P", "05/02/1994", 1000000, "1BD4")
DTMABA.Rows.Add("46112039", "Carissa
Evan Anthen", "P", "10/23/1994", 6000000, "1BD4")
DTMABA.Rows.Add("46112052", "Aprianto
Sandy", "L", "04/11/1993", 3000000, "1BD4")
DTMABA.Rows.Add("46112049", "Muhammad
Farid Syah", "L", "01/20/1995", 5000000, "1BD4")
DTMABA.Rows.Add("46112033", "Maulanan
Ibrahim", "L", "04/10/1994", 1000000, "1BD4")
DTMABA.Rows.Add("46112035", "Herpita
Tohura", "P", "10/24/1993", 700000, "1BD4")
DTMABA.Rows.Add("46112048", "Udin
Pranata", "L", "01/29/1993", 1000000, "1BD4")
DTMABA.Rows.Add("46112051", "Afrisca
Fraktiani Rante", "P", "04/13/1995", 5000000, "1BD4")
DTMABA.Rows.Add("46112056", "Kartini
Widyasita", "P", "04/21/1993", 4650000, "1BD4")
DTMABA.Rows.Add("46112045", "Abdul
Qawwam Nurjaya", "L", "11/26/1994", 3500000, "1BD4")
DTMABA.Rows.Add("46112040", "Tommy
Paunganan", "L", "02/22/1993", 2000000, "1BD4")
DTMABA.Rows.Add("46112053", "Khusnul
Khatimah A", "P", "08/27/1994", 3000000, "1BD4")
DTMABA.Rows.Add("46112041", "Nida
Hazimah Ulfah", "P", "09/24/1995", 5000000, "1BD4")
DTMABA.Rows.Add("46112044", "Ulfah
Nas", "P", "01/26/1994", 5000000, "1BD4")
DTMABA.Rows.Add("46112036", "Hasmiati
Hajar", "P", "05/17/1994", 5000000, "1BD4")
DTMABA.Rows.Add("36112001", "Fitri",
"P", "10/20/1994", 5000000, "1AD3")
DTMABA.Rows.Add("36112002", "andri
prianto tukan", "L", "04/26/1994", 2000000, "1BD3")
DTMABA.Rows.Add("36112003", "Fathin
Ammar Asidik", "L", "06/29/1994", 6800000, "1AD3")
DTMABA.Rows.Add("36112004", "Endah
Mariadi", "P", "11/07/1994", 7500000, "1AD3")
DTMABA.Rows.Add("36112005", "Mawar
Aztanti", "P", "06/01/1993", 4000000, "1AD3")
DTMABA.Rows.Add("36112006", "Izmi
Istiqamah", "P", "11/04/1994", 7000000, "1AD3")
DTMABA.Rows.Add("36112007", "Imran
Novrin Ruslim", "L", "11/21/1994", 1000000, "1AD3")
DTMABA.Rows.Add("36112008", "Adbul
Malik", "L", "11/09/1993", 2500000, "1AD3")
DTMABA.Rows.Add("36112010", "Yulianti",
"P", "09/28/1994", 2500000, "1AD3")
DTMABA.Rows.Add("36112011", "Zulfitra
Qadar Yasin", "L", "03/10/1994", 10000000, "1AD3")
DTMABA.Rows.Add("36112012", "Sri
Aprianti", "P", "04/05/1994", 4000000, "1AD3")
DTMABA.Rows.Add("36112013", "Noviantri
Paembonan", "P", "11/19/1994", 6000000, "1AD3")
DTMABA.Rows.Add("36112016", "Andi
Jusma Nilam Sari", "P", "09/02/1994", 10000000, "1AD3")
DTMABA.Rows.Add("36112017", "Dana
Abrian", "L", "10/05/1994", 5000000, "1AD3")
DTMABA.Rows.Add("36112018", "Kurniawati",
"P", "10/11/1994", 2000000, "1AD3")
DTMABA.Rows.Add("36112020", "Bernard
Talebong", "P", "10/01/1994", 10000000, "1AD3")
DTMABA.Rows.Add("36112023", "Andi
Arhami Hamzah", "P", "06/28/1994", 10000000, "1AD3")
DTMABA.Rows.Add("36112024", "Syahrul
Kamal", "L", "10/18/1994", 10000000, "1AD3")
DTMABA.Rows.Add("36112027", "Nurul
Rezki Susanti", "P", "09/24/1994", 5000000, "1AD3")
DTMABA.Rows.Add("36112059", "Ummul
Hayyul Qayyum", "P", "12/01/1993", 3500000, "1AD3")
DTMABA.Rows.Add("36112022", "Rismawati",
"P", "09/07/1994", 900000, "1AD3")
DTMABA.Rows.Add("36112026", "Melinda
Rizkawati", "P", "05/07/1994", 2000000, "1AD3")
DTMABA.Rows.Add("36112025", "Ivana
Olivia Aser", "P", "01/14/1993", 6000000, "1AD3")
DTMABA.Rows.Add("36112021", "Sulaipah",
"P", "09/28/1994", 1000000, "1AD3")
DTMABA.Rows.Add("36112061", "Rahmat
Adi Pratama", "L", "04/21/1994", 10000000, "1AD3")
DTMABA.Rows.Add("36112060", "Nita",
"P", "01/04/1995", 2500000, "1AD3")
DTMABA.Rows.Add("36112019", "Kharisma
Yusuf", "P", "06/14/1994", 4000000, "1AD3")
DTMABA.Rows.Add("36112014", "A.
Rahmawaty", "P", "04/04/1994", 5000000, "1AD3")
DTMABA.Rows.Add("36112015", "Danela
Mangintek", "P", "11/06/1994", 3000000, "1AD3")
DTMABA.Rows.Add("36112009", "Rahmaniah",
"P", "01/19/1994", 2500000, "1AD3")
DTMABA.Rows.Add("36112057", "Reenaldy
Alchudri Azsagaf", "L", "05/03/1994", 10000000, "1BD3")
DTMABA.Rows.Add("36112039", "Andi
Syahril", "L", "10/02/1994", 2000000, "1BD3")
DTMABA.Rows.Add("36112051", "Muhammad
Adhe Anugrah", "L", "08/31/1993", 5000000, "1BD3")
DTMABA.Rows.Add("36112042", "Sukmawati
Amir", "P", "04/13/1994", 6000000, "1BD3")
DTMABA.Rows.Add("36112019", "Dian
Eka Puteri", "P", "11/11/1993", 1000000, "1BD3")
DTMABA.Rows.Add("36112048", "Tri
Wahyuni", "P", "11/11/1994", 800000, "1BD3")
DTMABA.Rows.Add("36112047", "A.
Dian Pelita Waty", "P", "05/05/1994", 3000000, "1BD3")
DTMABA.Rows.Add("36112028", "Mu'minat
Nur", "P", "05/17/1995", 5000000, "1BD3")
DTMABA.Rows.Add("36112038", "Andi
Anggi Fadliyah", "P", "08/15/1994", 1500000, "1BD3")
DTMABA.Rows.Add("36112033", "A.
Syasya Annisa Ausan", "P", "08/08/1994", 7000000, "1BD3")
DTMABA.Rows.Add("36112044", "Muhammad
Fachri Sani", "L", "02/02/1994", 5000000, "1BD3")
DTMABA.Rows.Add("36112053", "Resky
Yonada Ahmad", "P", "03/22/1994", 1500000, "1BD3")
DTMABA.Rows.Add("36112029", "Trinayanti",
"P", "06/03/1992", 3000000, "1BD3")
DTMABA.Rows.Add("36112041", "Musyarafah
Asis", "L", "07/13/1994", 6000000, "1BD3")
DTMABA.Rows.Add("36112055", "Achmad
Rezky Satria Perdana", "L", "12/17/1993", 3000000, "1BD3")
DTMABA.Rows.Add("36112040", "Fibra
Yoseph P", "P", "03/27/1995", 6000000, "1BD3")
DTMABA.Rows.Add("36112045", "Ibnu
Affan Al-Mufar'id", "L", "08/05/1994", 8000000, "1BD3")
DTMABA.Rows.Add("36112030", "Sri
Widya Ayu Wandini", "P", "06/01/1994", 5000000, "1BD3")
DTMABA.Rows.Add("36112046", "Sri
Wahyuni Hafid", "P", "12/25/1994", 11000000, "1BD3")
DTMABA.Rows.Add("36112032", "Rosita
Satri", "P", "12/06/1994", 3000000, "1BD3")
DTMABA.Rows.Add("36112052", "Sabri",
"L", "07/24/1993", 700000, "1BD3")
DTMABA.Rows.Add("36112049", "Alfin
Riani Bandaso", "P", "04/11/1994", 3000000, "1BD3")
DTMABA.Rows.Add("36112036", "Nurmilasari",
"P", "07/06/1993", 2000000, "1BD3")
DTMABA.Rows.Add("36112035", "Tri
Arismunandar", "L", "12/09/1993", 1000000, "1BD3")
DTMABA.Rows.Add("36112031", "Nur
Indahsari Idris", "P", "08/28/1994", 5000000, "1BD3")
DTMABA.Rows.Add("36112037", "Ismawati",
"P", "08/01/1994", 900000, "1BD3")
DTMABA.Rows.Add("36112034", "Rezky
Arianti", "P", "01/27/1994", 3000000, "1BD3")
DTMABA.Rows.Add("36112043", "Artis
Susan", "P", "10/29/1993", 5000000, "1BD3")
DTMABA.Rows.Add("36112054", "Ade
Apriathis Rantelino", "L", "04/27/1994", 3000000, "1BD3")
DV = DTMABA.DefaultView
ISI_46110007.DataSource = DV
End Sub
Private Sub STB_46110007_CheckedChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles
STB_46110007.CheckedChanged
If STB_46110007.Checked = True Then
DV.Sort = "Stambuk"
End If
End Sub
Private Sub KLS_46110007_CheckedChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles
KLS_46110007.CheckedChanged
If KLS_46110007.Checked = True Then
DV.Sort = "kelas desc"
End If
End Sub
Private Sub TGL_46110007_CheckedChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles TGL_46110007.CheckedChanged
If TGL_46110007.Checked = True Then
DV.Sort = "kelas,tanggal
Lahir"
End If
End Sub
Private Sub GAJI_46110007_CheckedChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles
GAJI_46110007.CheckedChanged
If GAJI_46110007.Checked = True Then
DV.Sort = "Gaji Ortu
desc"
End If
End Sub
Private Sub GOTLD_46110007_TextChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles GOTLD_46110007.TextChanged
DV.RowFilter = "[Gaji Ortu] >
" & Val(GOTLD_46110007.Text)
End Sub
Private Sub BK_46110007_TextChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles BK_46110007.TextChanged
DV.RowFilter = "Kelas <>
'" & BK_46110007.Text & "'"
End Sub
Private Sub TLS_46110007_ValueChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles
TLS_46110007.ValueChanged
DV.RowFilter = "[Tanggal Lahir]
< #" & TLS_46110007.Value.Date & "#"
End Sub
Private Sub NMU_46110007_TextChanged(ByVal
sender As Object, ByVal e As System.EventArgs) Handles NMU_46110007.TextChanged
DV.RowFilter = "nama like '%"
& NMU_46110007.Text & "%'"
End Sub
Private Sub T2_46110007_Click(ByVal sender As
Object, ByVal e As System.EventArgs) Handles T2_46110007.Click
For Each FANTY As DataGridViewRow In
ISI_46110007.Rows
If FANTY.Cells("gaji
ortu").Value > 6000000 Then
FANTY.DefaultCellStyle.BackColor = W1_46110007.BackColor
ElseIf FANTY.Cells("gaji
ortu").Value > 5000000 Then
FANTY.DefaultCellStyle.BackColor = W2_46110007.BackColor
ElseIf FANTY.Cells("gaji
ortu").Value > 4000000 Then
FANTY.DefaultCellStyle.BackColor = W3_46110007.BackColor
ElseIf FANTY.Cells("gaji
ortu").Value > 3000000 Then
FANTY.DefaultCellStyle.BackColor = W4_46110007.BackColor
ElseIf FANTY.Cells("gaji
ortu").Value > 2000000 Then
FANTY.DefaultCellStyle.BackColor = W5_46110007.BackColor
Else
FANTY.DefaultCellStyle.BackColor
= W6_46110007.BackColor
End If
Next
End Sub
Private Sub T1_46110007_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles T1_46110007.Click
DV.RowFilter = "[Gaji ortu] >
" & Val(GOTLD2_46110007.Text) & " and kelas <>"
& "'" & BK2_46110007.Text & "'" & "and
[tanggal lahir] < #" & TLS2_46110007.Value.Month & "/"
& TLS2_46110007.Value.Day & "/" &
TLS2_46110007.Value.Year & "#" & " and nama like
'%" & NMU2_46110007.Text & "%'"
End Sub
End Class
· Untuk menjalankan form tekan F5
B. Deskripsi Form Latihan 14
Pada form latihan 14 ada 7 object
yang digunakan yaitu Label, Text Box, Button, Date Time
Picker, Radio Button, Data Grid View dan Group Box.
Object Label
Terdapat 8 label pada form
latihan 14 (gaji orang tua lebih dari
(2), bukan kelas (2), tanggal lahir sebelum (2) dan nama yang memiliki unsur
(2)).
Object TextBox
Pada form ini ada 12 textbox yang
digunakan (6 status input dan 6 status readonly). Status input digunakan untuk
memasukkan data sedangkan readonly dalam form ini digunakan sebagai pengganti
label yang berguna dalam pengklasifikasian gaji (gaji ortu>=6000000, gaji ortu>=5000000, gaji
ortu>=4000000, gaji ortu>=3000000, gaji ortu>=2000000, selain itu).
Object
Button
Terdapat 2 object button (filter
dan atur warna). Tombol filter digunakan untuk memfilter data tabel berdasarkan
data yang telah diinput pada textbox yang tersedia. Tombol atur warna digunakan
dalam pengklasifikasian gaji orang tua yang nantinya akan memberi warna
tertentu sesuai klasifikasi yang telah dibuat.
Object
DateTimePicker
Pada latihan 14
terdapat 2 datetimepicker. Datetimepicker digunakan dalam menginput data berupa
tahun, bulan dan tanggal.
Object RadioButton
Radiobutton pada form ini ada 4 (stambuk, kelas
(besaràkecil), kelas (kecilàbesar) tanggal lahir (kecilàbesar) dan gaji orang tua (kecilàbesar) berisi perintah.
Object GroupBox
Terdapat 4
object groupbox pada latihan 14 (urutkan
berdasarkan, filter berdasarkan, filter dengan menggabungkan dan pengaturan
warna).
Object DataGridView
Terdapat 1 object datagridview yang berfungsi
untuk menampilkan data tabel yang telah dibuat.
Script Unique
Untuk membuat data tabel
Dim tabel As New DataTable
Membuat kolom pada data tabel
tabel.Columns.Add(New
DataColumn("no. pembelian", GetType(String)))
tabel.Columns.Add(New DataColumn("nama
barang", GetType(String)))
Membuat
data source
ISI_46110007.DataSource =
DV
Menginput
data
DTMABA.Rows.Add("46112003",
"Nurawalia M", "P", "12/04/1994", 3000000,
"1AD4")
DTMABA.Rows.Add("46120023",
"Puspita Susilawati Ridjal", "P", "01/01/1994",
4000000, "1AD4")
Mengurutkan
data berdasarkan perintah
If STB_46110007.Checked = True
Then
DV.Sort = "Stambuk"
End If
Memfilter
data berdasarkan perintah
DV.RowFilter = "[Gaji
Ortu] > " & Val(GOTLD_46110007.Text)
Memfilter
data dengan lebih dari satu kriteria sekaligus
DV.RowFilter = "[Gaji
ortu] > " & Val(GOTLD2_46110007.Text) & " and kelas
<>" & "'" & BK2_46110007.Text & "'"
& "and [tanggal lahir] < #" & TLS2_46110007.Value.Month
& "/" & TLS2_46110007.Value.Day & "/" &
TLS2_46110007.Value.Year & "#" & " and nama like
'%" & NMU2_46110007.Text & "%'"
Memberi
warna di setiap klasifikasi gaji orang tua (telah ditentukan)
If FANTY.Cells("gaji
ortu").Value > 6000000 Then
FANTY.DefaultCellStyle.BackColor
= W1_46110007.BackColor
Even
ButtonClick
TextChanged
CheckedChanged
Load
ValueChanged
Property
Property TextBox => ReadOnly =
True
Property TextBox => BackColor
Langkah-Langkah Menjalankan Form Latihan
14
- Untuk menjalankan perintah pada GroupBox 1 (urutkan berdasarkan) pilih salah satu perintah dengan meng-klik perintah yang diinginkan. Datagrideview akan menampilkan tabel sesuai perintah.
- Untuk menjalankan perintah pada GroupBox 2 (filter berdasarkan) input data pada textbox yang tersedia. Datagrideview akan menampilkan tabel sesuai perintah yang telah diinput.
- Untuk menjalankan perintah pada GroupBox 3 (filter dengan menggabungkan) input data pada semua textbox yang tersedia, kemudian klik tombol “Filter”. Datagrideview akan menampilkan tabel sesuai perintah yang diinput.
- Untuk menjalankan perintah pada GroupBox 4 (pengaturan warna) cukup dengan meng-klik tombol “Atur Warna”. Tabel akan berwarna sesuai klasifikasi gaji.
- Selamat mencoba (:
Posting Komentar