Sabtu, 21 Januari 2012

MEMBUAT MENU PADA VB NET DENGAN LISTVIEW

1.DESIGN FORM LOGIN


 2. LISTING PROGRAM
Public Class Form1


    Private Sub BTNOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNOK.Click
        If username.Text = "ANDARI" And password.Text = "111" Then
            MsgBox("Wellcome")
            MENUUTAMA.Show()
            Me.Hide()
        Else
            MsgBox("Maaf Username / Password Salah !")
            username.Text = ""
            password.Text = ""
        End If
    End Sub


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


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    End Sub
End Class

3. BUAT FORM BARU (MENUUTAMA)


4.LISTING PROGRAM

Public Class MENUUTAMA


    Private Sub DATAPEGAWAIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DATAPEGAWAIToolStripMenuItem.Click
        PEGAWAI.SHOW()
    End Sub


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


    Private Sub MENUUTAMA_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    End Sub
End Class

5. BUAT FORM BARU LAGI (PEGAWAI)


6. LISTING PROGRAM

Public Class PEGAWAI


    Private Sub PEGAWAI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BuatTabel()
        NIP.Items.Add("001")
        NIP.Items.Add("002")
        NIP.Items.Add("003")
        GOL.Items.Add("IIIA")
        GOL.Items.Add("IIIB")
        GOL.Items.Add("IIIC")
        STATUS.Items.Add("MENIKAH")
        STATUS.Items.Add("TIDAK MENIKAH")
        JLHANAK.Items.Add("0")
        JLHANAK.Items.Add("1")
        JLHANAK.Items.Add("2")
        JLHANAK.Items.Add("3")
    End Sub
        Sub BuatTabel()
        With LV()
            .Columns.Add("NIP", 80, HorizontalAlignment.Center)
            .Columns.Add("NAMA", 120, HorizontalAlignment.Left)
            .Columns.Add("GOL", 100, HorizontalAlignment.Left)
            .Columns.Add("GAJI", 80, HorizontalAlignment.Left)
            .Columns.Add("STATUS", 100, HorizontalAlignment.Left)
            .Columns.Add("TUNJANGAN ANAK", 120, HorizontalAlignment.Left)
            .Columns.Add("TUNJANGAN KELUARGA", 150, HorizontalAlignment.Left)
            .Columns.Add("JUMLAH ANAK", 80, HorizontalAlignment.Left)
            .Columns.Add("PAJAK", 80, HorizontalAlignment.Left)
            .Columns.Add("TOTAL GAJI", 80, HorizontalAlignment.Left)
            .GridLines = True
            .FullRowSelect = True
            .View = View.Details
        End With
    End Sub
    Sub IsiTabel()
        Dim Lst As New ListViewItem
        With Lst
            .Text = NIP.Text(0)
            .SubItems.Add(NAMA.Text)
            .SubItems.Add(GOL.Text)
            .SubItems.Add(GAJI.Text)
            .SubItems.Add(STATUS.Text)
            .SubItems.Add(TUNJANGANANAK.Text)
            .SubItems.Add(TUNJANGANKELUARGA.Text)
            .SubItems.Add(JLHANAK.Text)
            .SubItems.Add(PAJAK.Text)
            .SubItems.Add(TTLGAJI.Text)
            LV.Items.Add(Lst)
        End With
    End Sub




    Private Sub NIP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NIP.SelectedIndexChanged
        If NIP.Text = "001" Then
            NAMA.Text = "ANDARI"
        ElseIf NIP.Text = "002" Then
            NAMA.Text = "JUNADI"
        ElseIf NIP.Text = "003" Then
            NAMA.Text = "WINARI"
        Else
            NAMA.Text = " "
        End If


    End Sub


    Private Sub GOL_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GOL.SelectedIndexChanged
        If GOL.Text = "IIIA" Then
            GAJI.Text = 3000000
        ElseIf GOL.Text = "IIIB" Then
            GAJI.Text = 2500000
        ElseIf GOL.Text = "IIIC" Then
            GAJI.Text = 2000000
        Else
            GAJI.Text = " "
        End If
    End Sub


    Private Sub STATUS_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STATUS.SelectedIndexChanged
        If STATUS.Text = "MENIKAH" Then
            TUNJANGANKELUARGA.Text = 5 * GAJI.Text / 100
            TUNJANGANANAK.Text = 7 * GAJI.Text / 100
            PAJAK.Text = 5 * GAJI.Text / 100
        ElseIf STATUS.Text = "TIDAK MENIKAH" Then
            TUNJANGANANAK.Text = 0
            TUNJANGANKELUARGA.Text = 0
        Else
            STATUS.Text = " "
        End If
        Call proses()
    End Sub
    Sub proses()
        TTLGAJI.Text = Val(GAJI.Text) + Val(TUNJANGANANAK.Text) + Val(TUNJANGANKELUARGA.Text) - Val(PAJAK.Text)
    End Sub


    Private Sub BTNSIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNSIMPAN.Click
        IsiTabel()
    End Sub


    Private Sub BTNKELUAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNKELUAR.Click
        End
    End Sub
End Class

7.JALANKAN (TEKAN F5)

MAKA AKAN MUNCUL...


JIKA KITA KLIK OK
MAKA AKAN MUNCUL....


KLIK MENU FILE PILIH DATA PEGAWAI
DAN HASILNYA......

SELAMAT MENCOBA DAN SEMOGA BERHASIL........:-)


2 komentar:

  1. hai...
    http://hairilhamzah.blogspot.com/

    BalasHapus
  2. kalau cara edit dan delete dengan button Edit dan Delete itu gimana caranya..

    BalasHapus