Minggu, 29 November 2015

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

Program Pembayaran Tagihan Listrik




Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        lv.Columns.Add("Kode Pelanggan", 90, HorizontalAlignment.Left)
        lv.Columns.Add("Jenis Pelanggan", 140, HorizontalAlignment.Left)
        lv.Columns.Add("Beban", 90, HorizontalAlignment.Left)
        lv.Columns.Add("Harga", 120, HorizontalAlignment.Left)
        lv.Columns.Add("Jumlah Pemakaian", 120, HorizontalAlignment.Left)
        lv.Columns.Add("Pembayaran", 130, HorizontalAlignment.Left)

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


        For i = 1 To 3
            kd_pelanggan.Items.Add("00" & i)
        Next
    End Sub

    Private Sub kd_pelanggan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kd_pelanggan.SelectedIndexChanged
        If kd_pelanggan.Text = "001" Then
            jenis_pelanggan.Text = "Rumah"
            biaya.Text = 25000
            harga.Text = 3000
        ElseIf kd_pelanggan.Text = "002" Then
            jenis_pelanggan.Text = "Toko"
            biaya.Text = 50000
            harga.Text = 5000
        ElseIf kd_pelanggan.Text = "003" Then
            jenis_pelanggan.Text = "Pabrik"
            biaya.Text = 100000
            harga.Text = 10000
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim a As New ListViewItem
        a.Text = kd_pelanggan.Text
        a.SubItems.Add(jenis_pelanggan.Text)
        a.SubItems.Add(biaya.Text)
        a.SubItems.Add(harga.Text)
        a.SubItems.Add(jlh_pemakaian.Text)
        a.SubItems.Add(pembayaran.Text)
        lv.Items.Add(a)

        pembayaran.Text = Val(biaya.Text) + Val(harga.Text) * jlh_pemakaian.Text
    End Sub

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

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        kd_pelanggan.Text = ""
        jenis_pelanggan.Text = ""
        biaya.Text = ""
        jlh_pemakaian.Text = ""
        pembayaran.Text = ""
        harga.Text = ""
    End Sub
End Class



Demikianlah postingan saya  Nama : (DELISMAN LAIA)  NPM : (14110194)
Selamat Belajar Pemrograman VB NET

Tidak ada komentar :

Posting Komentar