Selasa, 14 Mei 2013

Tugas Bahasa Pemrograman


  • Membuat Desain seperti dibawah ini!!!




  • Public Class Form1

        Sub isitabel()
            Dim lst As New ListViewItem
            lst.Text = NIK.Text
            lst.SubItems.Add(Nama.Text)
            lst.SubItems.Add(Jabatan.Text)
            lst.SubItems.Add(Gaji.Text)
            lst.SubItems.Add(Status.Text)
            lst.SubItems.Add(Tunjangan.Text)
            lst.SubItems.Add(Pajak.Text)
            lst.SubItems.Add(Total.Text)
            Lv.Items.Add(lst)
        End Sub

        Sub BuatTabel()
            LV.Columns.Add("NIK", 50, HorizontalAlignment.Center)
            LV.Columns.Add("Nama", 100, HorizontalAlignment.Left)
            LV.Columns.Add("Jabatan", 100, HorizontalAlignment.Left)
            LV.Columns.Add("Gaji", 80, HorizontalAlignment.Left)
            LV.Columns.Add("Status", 80, HorizontalAlignment.Left)
            LV.Columns.Add("Tunjangan", 80, HorizontalAlignment.Left)
            LV.Columns.Add("Pajak", 180, HorizontalAlignment.Left)
            LV.Columns.Add("Total Gaji", 180, HorizontalAlignment.Left)
            LV.View = View.Details
            LV.GridLines = True
            LV.FullRowSelect = True
        End Sub

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            BuatTabel()
            NIK.Items.Add("001")
            NIK.Items.Add("002")
            NIK.Items.Add("003")
            Jabatan.Items.Add("Mandor")
            Jabatan.Items.Add("Kepala Bagian")
            Jabatan.Items.Add("Staf")
            Status.Items.Add("Menikah")
            Status.Items.Add("Tidak Menikah")
        End Sub

        Private Sub Jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jabatan.SelectedIndexChanged
            Select Case Jabatan.Text
                Case "Mandor" : Gaji.Text = 1750000
                Case "Kepala Bagian" : Gaji.Text = 2500000
                Case "Staf" : Gaji.Text = 1250000

            End Select
            Pajak.Text = 0.15 * Gaji.Text
        End Sub

        Private Sub NIK_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NIK.SelectedIndexChanged
            Select Case NIK.Text
                Case "001" : Nama.Text = "ISWAHYUNI"
                Case "002" : Nama.Text = "UDIN"
                Case "003" : Nama.Text = "UJANG"
            End Select
        End Sub

        Private Sub Status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Status.SelectedIndexChanged
            Select Case Status.Text
                Case "Menikah" : Tunjangan.Text = 0.15 * Gaji.Text
                Case "Tidak Menikah" : Tunjangan.Text = 0
            End Select
        End Sub

        Private Sub Btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnproses.Click
            Total.Text = Val(Gaji.Text) + Val(Tunjangan.Text) - Val(Pajak.Text)
        End Sub

        Private Sub Btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
            End
        End Sub

        Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
            isitabel()
            NIK.Text = ""
            Nama.Text = ""
            Jabatan.Text = ""
            Gaji.Text = ""
            Status.Text = ""
            Tunjangan.Text = ""
            Pajak.Text = ""
            Total.Text = ""
        End Sub

        Private Sub Btnhapusdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapusdata.Click
            LV.Items.Remove(LV.SelectedItems(0))
        End Sub

        Private Sub Btnhapussemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapussemua.Click
            LV.Items.Clear()
        End Sub
    End Class



Tidak ada komentar:

Posting Komentar