Senin, 15 Desember 2014

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
        Call buattabel()
        kode.Items.Add("Br-001")
        kode.Items.Add("Sk-001")
        kode.Items.Add("Br-002")
        kode.Items.Add("Sk-002")
        kode.Items.Add("Br-003")
        kode.Items.Add("Sk-003")
        kode.Items.Add("Br-004")
        kode.Items.Add("Sk-004")

        tahun.Items.Add("2011")
        tahun.Items.Add("2012")
        tahun.Items.Add("2013")
        tahun.Items.Add("2014")

        kondisi.Items.Add("Baru")
        kondisi.Items.Add("Bekas")

        lkredit.Items.Add("12 Bulan")
        lkredit.Items.Add("24 Bulan")
        lkredit.Items.Add("36 Bulan")
        lkredit.Items.Add("48 Bulan")
    End Sub
    Sub buattabel()
        lv.Columns.Add("Kode", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Mobil", 150, HorizontalAlignment.Left)
        lv.Columns.Add("Tahun", 100, HorizontalAlignment.Left)
        lv.Columns.Add("Kondisi", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Harga", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Lama Kredit", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Uang Muka", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Komisi Sales", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Total Kredit", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Angsuran", 80, HorizontalAlignment.Center)
        lv.View = View.Details
        lv.GridLines = True
        lv.FullRowSelect = True
    End Sub
    Sub isitabel()
        Dim lst As New ListViewItem
        lst.Text = kode.Text
        lst.SubItems.Add(mobil.Text)
        lst.SubItems.Add(tahun.Text)
        lst.SubItems.Add(kondisi.Text)
        lst.SubItems.Add(harga.Text)
        lst.SubItems.Add(jbeli.Text)
        lst.SubItems.Add(lkredit.Text)
        lst.SubItems.Add(tharga.Text)
        lst.SubItems.Add(umuka.Text)
        lst.SubItems.Add(ksales.Text)
        lst.SubItems.Add(tkredit.Text)
        lst.SubItems.Add(angsuran.Text)
        lv.Items.Add(lst)
    End Sub


    Private Sub mobil_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mobil.TextChanged

    End Sub

    Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
        If kode.Text = "Br-001" Then
            mobil.Text = "Avanza Veloz"
        ElseIf kode.Text = "Sk-001" Then
            mobil.Text = "Avanza Veloz"
        ElseIf kode.Text = "Br-002" Then
            mobil.Text = "Toyota Yaris"
        ElseIf kode.Text = "Sk-002" Then
            mobil.Text = "Toyota Yaris"
        ElseIf kode.Text = "Br-003" Then
            mobil.Text = "Kijang Inova"
        ElseIf kode.Text = "Sk-003" Then
            mobil.Text = "Kijang Inova"
        ElseIf kode.Text = "Br-004" Then
            mobil.Text = "Fortuner"
        ElseIf kode.Text = "Sk-004" Then
            mobil.Text = "Fortuner"
        End If

        If kode.Text = "Br-001" Then
            tahun.Text = "2011"
        ElseIf kode.Text = "Sk-001" Then
            tahun.Text = "2011"
        ElseIf kode.Text = "Br-002" Then
            tahun.Text = "2012"
        ElseIf kode.Text = "Sk-002" Then
            tahun.Text = "2012"
        ElseIf kode.Text = "Br-003" Then
            tahun.Text = "2013"
        ElseIf kode.Text = "Sk-003" Then
            tahun.Text = "2013"
        ElseIf kode.Text = "Br-004" Then
            tahun.Text = "2014"
        ElseIf kode.Text = "Sk-004" Then
            tahun.Text = "2014"
        End If

        If kode.Text = "Br-001" Then
            kondisi.Text = "Baru"
        ElseIf kode.Text = "Sk-001" Then
            kondisi.Text = "Bekas"
        ElseIf kode.Text = "Br-002" Then
            kondisi.Text = "Baru"
        ElseIf kode.Text = "Sk-002" Then
            kondisi.Text = "Bekas"
        ElseIf kode.Text = "Br-003" Then
            kondisi.Text = "Baru"
        ElseIf kode.Text = "Sk-003" Then
            kondisi.Text = "Bekas"
        ElseIf kode.Text = "Br-004" Then
            kondisi.Text = "Baru"
        ElseIf kode.Text = "Sk-004" Then
            kondisi.Text = "Bekas"
        End If

        If kode.Text = "Br-001" Then
            harga.Text = "20000000"
        ElseIf kode.Text = "Sk-001" Then
            harga.Text = "13000000"
        ElseIf kode.Text = "Br-002" Then
            harga.Text = "24000000"
        ElseIf kode.Text = "Sk-002" Then
            harga.Text = "20000000"
        ElseIf kode.Text = "Br-003" Then
            harga.Text = "30000000"
        ElseIf kode.Text = "Sk-003" Then
            harga.Text = "25000000"
        ElseIf kode.Text = "Br-004" Then
            harga.Text = "45000000"
        ElseIf kode.Text = "Sk-004" Then
            harga.Text = "40000000"
        End If


    End Sub

    Private Sub btnisi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnisi.Click
        Call isitabel()
        kode.Text = ""
        mobil.Text = ""
        tahun.Text = ""
        kondisi.Text = ""
        harga.Text = ""
        jbeli.Text = ""
        lkredit.Text = ""
        tharga.Text = ""
        umuka.Text = ""
        ksales.Text = ""
        tkredit.Text = ""
        angsuran.Text = ""
    End Sub

    Private Sub btnhapuslist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapuslist.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 btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        kode.Text = ""
        mobil.Text = ""
        tahun.Text = ""
        kondisi.Text = ""
        harga.Text = ""
        jbeli.Text = ""
        lkredit.Text = ""
        tharga.Text = ""
        umuka.Text = ""
        ksales.Text = ""
        tkredit.Text = ""
        angsuran.Text = ""
    End Sub

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        tharga.Text = jbeli.Text * harga.Text
        umuka.Text = 0.3 * tharga.Text
        ksales.Text = 0.2 * jbeli.Text * umuka.Text
        tkredit.Text = (tharga.Text - umuka.Text) / lkredit.Text
        lkredit.Text = ""
        angsuran.Text = tharga.Text * 0.3 * tkredit.Text / lkredit.Text
    End Sub
End Class






Tidak ada komentar:

Posting Komentar