Minggu, 29 November 2015

Yuk ! belajar bahasa pemograman Visual basic.net di mesran.net

Pembayaran Tagihan PDAM

Public Class Form1

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub

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

        lv.View = View.Details
        lv.GridLines = True
        lv.FullRowSelect = True

        kode.Items.Add("001")
        kode.Items.Add("002")

        tipe.Items.Add("Toko")
        tipe.Items.Add("Rumah")
        tipe.Items.Add("Swalayan")
        tipe.Items.Add("Pabrik")
    End Sub

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        totaltagihan.Text = Val(biayabeban.Text) + Val(harga.Text) * Val(jumlahpemakaian.Text)
        pajak.Text = 0.01 * totaltagihan.Text
        pembayaran.Text = Val(totaltagihan.Text) + Val(pajak.Text)

        Dim lst As New ListViewItem
        lst.Text = kode.Text
        lst.SubItems.Add(nama.Text)
        lst.SubItems.Add(tipe.Text)
        lst.SubItems.Add(harga.Text)
        lst.SubItems.Add(biayabeban.Text)
        lst.SubItems.Add(jumlahpemakaian.Text)
        lst.SubItems.Add(totaltagihan.Text)
        lst.SubItems.Add(pajak.Text)
        lst.SubItems.Add(pembayaran.Text)
        lv.Items.Add(lst)
    End Sub

    Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
        Select Case kode.Text
            Case "001"
                nama.Text = "Yusni"
            Case "002"
                nama.Text = "Depan"
            Case Else
                nama.Text = ""
        End Select
    End Sub

    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        lv.Items.Clear()
    End Sub

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

    Private Sub btnbatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbatal.Click
        kode.Text = ""
        nama.Text = ""
        tipe.Text = ""
        biayabeban.Text = ""
        harga.Text = ""
        jumlahpemakaian.Text = ""
        totaltagihan.Text = ""
        pajak.Text = ""
        pembayaran.Text = ""

    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"
                biayabeban.Text = 250000
                harga.Text = 300
            Case "Rumah"
                biayabeban.Text = 15000
                harga.Text = 100
            Case "Swalayan"
                biayabeban.Text = 10000
                harga.Text = 200
            Case "Pabrik"
                biayabeban.Text = 250000
                harga.Text = 500
        End Select
    End Sub
End Class

Demikian postingan saya
Nama    :Yusni elis saragih

NPM      :14110350