Sunday, December 8, 2013

Hasil listview Kasus Pemrograman Pemakaian Listrik


Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        daerah.Items.Add("MED")
        daerah.Items.Add("BEL")
        daerah.Items.Add("MAR")
        daerah.Items.Add("BIN")
        daerah.Items.Add("PAK")

        pelanggan.Items.Add("TOK")
        pelanggan.Items.Add("RUM")
        pelanggan.Items.Add("SWA")
        pelanggan.Items.Add("PAB")

        nourut.Items.Add("100")
        nourut.Items.Add("200")
        nourut.Items.Add("300")
        nourut.Items.Add("400")

        buattabel()
    End Sub

    Private Sub pelanggan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pelanggan.SelectedIndexChanged
        Select Case pelanggan.Text
            Case "TOK" : pemakaian.Text = 150000 + 500
            Case "RUM" : pemakaian.Text = 5000 + 200
            Case "SWA" : pemakaian.Text = 400000 + 1500
            Case "PAB" : pemakaian.Text = 1000000 + 10000
        End Select

    End Sub

    Private Sub daerah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles daerah.SelectedIndexChanged
        Select Case daerah.Text
            Case "MED" : daera.Text = "Medan"
            Case "BEL" : daera.Text = "Belawan"
            Case "MAR" : daera.Text = "Marelan"
            Case "BIN" : daera.Text = "Binjai"
            Case "PAK" : daera.Text = "Pakam"

        End Select
    End Sub

    Private Sub nourut_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nourut.SelectedIndexChanged
        Select Case nourut.Text
            Case "100" : nama.Text = "Linsun"
            Case "200" : nama.Text = "Hamsiong"
            Case "300" : nama.Text = "Liing"
            Case "400" : nama.Text = "Osim"
        End Select
    End Sub

    Private Sub Bproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bproses.Click
        Total.Text = pemakaian.Text * 1.5
        isitabel()
    End Sub
    Sub buattabel()
        ListView1.Columns.Add("Kode Pelanggan", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("Daerah", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("Nama", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("No Urut", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("Pemakaian", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("Total Biaya", 80, HorizontalAlignment.Center)
        ListView1.View = View.Details
        ListView1.GridLines = True
        ListView1.FullRowSelect = True
    End Sub
    Sub isitabel()
        Dim x As New ListViewItem
        x.Text = daerah.Text
        x.SubItems.Add(pelanggan.Text)
        x.SubItems.Add(daera.Text)
        x.SubItems.Add(nourut.Text)
        x.SubItems.Add(nama.Text)
        x.SubItems.Add(pemakaian.Text)
        x.SubItems.Add(Total.Text)
        ListView1.Items.Add(x)
    End Sub

    Private Sub Bkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bkeluar.Click
        Close()
    End Sub

    Private Sub Bhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bhapus.Click
        ListView1.Items.Clear()
    End Sub
End Class

Hasil listview Kasus Pemrograman Pemakaian Listrik Rating: 4.5 Diposkan Oleh: Unknown

0 comments:

Post a Comment

Isikan Komentar Yang Bermanfaat Untuk Membangun ya Gann....