Saturday, 28 November 2015

Yuk! Belajar Pemrograman Visual Basic dot Net Di Mesran.Net


Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LV.Columns.Add("Kode", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Nama", 150, HorizontalAlignment.Center)
        LV.Columns.Add("Tipe", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Biaya Beban", 180, HorizontalAlignment.Center)
        LV.Columns.Add("Jumlah Pemakaian", 180, HorizontalAlignment.Center)
        LV.Columns.Add("Total Tagihan", 180, HorizontalAlignment.Center)
        LV.Columns.Add("Pajak", 180, HorizontalAlignment.Center)
        LV.Columns.Add("Pembayaran", 180, HorizontalAlignment.Center)
        LV.Columns.Add("Harga", 100, HorizontalAlignment.Center)



        LV.View = View.Details
        LV.GridLines = True
        LV.FullRowSelect = True

        K_Pelanggan.Items.Add("001")
        K_Pelanggan.Items.Add("002")
        K_Pelanggan.Items.Add("003")

        Tipe.Items.Add("Toko")
        Tipe.Items.Add("Rumah")
        Tipe.Items.Add("Swelayan")
        Tipe.Items.Add("Pabrik")
    End Sub

    Private Sub K_Pelanggan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles K_Pelanggan.SelectedIndexChanged
        Select K_Pelanggan.Text
            Case "001"
                Nama.Text = "Adi Mora"
            Case "002"
                Nama.Text = "Eko"
            Case "003"
                Nama.Text = "Dian"
        End Select
    End Sub

    Private Sub Tipe_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tipe.SelectedIndexChanged
        Select Case Tipe.Text
            Case "Toko"
                B_Beban.Text = 250000
                Harga.Text = 300
            Case "Rumah"
                B_Beban.Text = 15000
                Harga.Text = 100
            Case "Swelayan"
                B_Beban.Text = 1000000
                Harga.Text = 200
            Case "Pabrik"
                B_Beban.Text = 2500000
                Harga.Text = 500
        End Select
    End Sub

    Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProses.Click
        T_Tagihan.Text = Val(B_Beban.Text) + Val(Harga.Text) * Val(J_Pemakaian.Text)

        Pajak.Text = 0.01 * T_Tagihan.Text
        Pembayaran.Text = Val(T_Tagihan.Text) + Val(Pajak.Text)

       
    End Sub

    Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.Click
        K_Pelanggan.Text = ""
        Nama.Text = ""
        Tipe.Text = ""
        B_Beban.Text = ""
        J_Pemakaian.Text = ""
        T_Tagihan.Text = ""
        Pajak.Text = ""
        Pembayaran.Text = ""
        Harga.Text = ""
    End Sub

    Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Lst As New ListViewItem
        Lst.Text = K_Pelanggan.Text
        Lst.SubItems.Add(Nama.Text)
        Lst.SubItems.Add(Tipe.Text)
        Lst.SubItems.Add(B_Beban.Text)
        Lst.SubItems.Add(J_Pemakaian.Text)
        Lst.SubItems.Add(T_Tagihan.Text)
        Lst.SubItems.Add(Pajak.Text)
        Lst.SubItems.Add(Pembayaran.Text)
        Lst.SubItems.Add(Harga.Text)
        LV.Items.Add(Lst)
    End Sub

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


Demikilahlah postingan saya  Nama : Adi Mora  NPM : 14110080  Selamat Belajar Pemrograman VB NET  mesran.net

No comments:

Post a Comment