SELAMAT DATANG DI BLOG SAYA
Dancing Banana

Minggu, 07 Desember 2014

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

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

1.pertama yang harus di lakukan adalah,,desain dahulu di dalam vb.2008
   Seperti di bawah ini:


  
2.buat lah koding masing-masing from load:
  Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call BuatTabel()
        kodemobil.Items.Add("MB1")
        kodemobil.Items.Add("MB2")
        kodemobil.Items.Add("MB3")
        kodemobil.Items.Add("MB4")
        kodemobil.Items.Add("MB5")

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

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

        For i = 1 To 10
            jbeli.Items.Add(i)
        Next
        For j = 12 To 48 Step 6
            lamakeredit.Items.Add(j)
        Next

    End Sub

    Sub BuatTabel()
        lv.Columns.Add("Kode Mobil", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Merek Mobil", 100, HorizontalAlignment.Left)
        lv.Columns.Add("Kondisi", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Tahun Mobil", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Harga", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Total Harga", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Komisi Sales", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Lama Keredit", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Harga Keredit", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Uang Muka", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Sisa Keredit", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Angsuran/Bulan", 100, HorizontalAlignment.Left)
        lv.View = View.Details
        lv.GridLines = True
        lv.FullRowSelect = True
    End Sub

    Sub IsiTabel()
        Dim lst As New ListViewItem
        lst.Text = kodemobil.Text
        lst.SubItems.Add(merek.Text)
        lst.SubItems.Add(kondisi.Text)
        lst.SubItems.Add(tahun.Text)
        lst.SubItems.Add(harga.Text)
        lst.SubItems.Add(jbeli.Text)
        lst.SubItems.Add(tharga.Text)
        lst.SubItems.Add(komisisales.Text)
        lst.SubItems.Add(lamakeredit.Text)
        lst.SubItems.Add(hargakeredit.Text)
        lst.SubItems.Add(uangmuka.Text)
        lst.SubItems.Add(sisakeredit.Text)
        lst.SubItems.Add(angsuran.Text)
        lv.Items.Add(lst)
    End Sub

    Sub bersih()
        kodemobil.Text = ""
        merek.Text = ""
        kondisi.Text = ""
        tahun.Text = ""
        harga.Text = ""
        jbeli.Text = ""
        tharga.Text = ""
        komisisales.Text = ""
        lamakeredit.Text = ""
        hargakeredit.Text = ""
        uangmuka.Text = ""
        sisakeredit.Text = ""
        angsuran.Text = ""
    End Sub

    Private Sub tmobil_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kondisi.SelectedIndexChanged

    End Sub

    Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kodemobil.SelectedIndexChanged
        If kodemobil.Text = "MB1" Then
            merek.Text = "Avanza Veloz"
        ElseIf kodemobil.Text = "MB2" Then
            merek.Text = "Avanza 6"
        ElseIf kodemobil.Text = "MB3" Then
            merek.Text = "Zenia 6"
        ElseIf kodemobil.Text = "MB4" Then
            merek.Text = "Toyota"
        ElseIf kodemobil.Text = "MB5" Then
            merek.Text = "Yaris"
        End If

    End Sub

    Private Sub tahun_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tahun.SelectedIndexChanged
        If kodemobil.Text = "MB1" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
            harga.Text = 175000000
        ElseIf kodemobil.Text = "MB1" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
            harga.Text = 120000000
        ElseIf kodemobil.Text = "MB1" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
            harga.Text = 195000000
        ElseIf kodemobil.Text = "MB1" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
            harga.Text = 130000000
        ElseIf kodemobil.Text = "MB1" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
            harga.Text = 208000000
        ElseIf kodemobil.Text = "MB1" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
            harga.Text = 170000000
        End If

        If kodemobil.Text = "MB2" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
            harga.Text = 185000000
        ElseIf kodemobil.Text = "MB2" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
            harga.Text = 135000000
        ElseIf kodemobil.Text = "MB2" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
            harga.Text = 200000000
        ElseIf kodemobil.Text = "MB2" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
            harga.Text = 145000000
        ElseIf kodemobil.Text = "MB2" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
            harga.Text = 220000000
        ElseIf kodemobil.Text = "MB2" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
            harga.Text = 180000000
        End If

        If kodemobil.Text = "MB3" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
            harga.Text = 170000000
        ElseIf kodemobil.Text = "MB3" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
            harga.Text = 125000000
        ElseIf kodemobil.Text = "MB3" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
            harga.Text = 185000000
        ElseIf kodemobil.Text = "MB3" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
            harga.Text = 125000000
        ElseIf kodemobil.Text = "MB3" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
            harga.Text = 200000000
        ElseIf kodemobil.Text = "MB3" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
            harga.Text = 160000000
        End If

        If kodemobil.Text = "MB4" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
            harga.Text = 150000000
        ElseIf kodemobil.Text = "MB4" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
            harga.Text = 100000000
        ElseIf kodemobil.Text = "MB4" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
            harga.Text = 170000000
        ElseIf kodemobil.Text = "MB4" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
            harga.Text = 120000000
        ElseIf kodemobil.Text = "MB4" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
            harga.Text = 190000000
        ElseIf kodemobil.Text = "MB4" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
            harga.Text = 140000000
        End If

        If kodemobil.Text = "MB5" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
            harga.Text = 175000000
        ElseIf kodemobil.Text = "MB5" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
            harga.Text = 150000000
        ElseIf kodemobil.Text = "MB5" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
            harga.Text = 200000000
        ElseIf kodemobil.Text = "MB5" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
            harga.Text = 175000000
        ElseIf kodemobil.Text = "MB5" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
            harga.Text = 250000000
        ElseIf kodemobil.Text = "MB5" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
            harga.Text = 200000000
        End If
    End Sub

    Private Sub jbeli_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jbeli.SelectedIndexChanged
        If jbeli.Text = "1" Then
            angsuran.Text = 5000000
        ElseIf jbeli.Text = "2" Then
            angsuran.Text = 10000000
        ElseIf jbeli.Text = "3" Then
            angsuran.Text = 30000000
        ElseIf jbeli.Text = "4" Then
            angsuran.Text = 7000000
        ElseIf jbeli.Text = "5" Then
            angsuran.Text = 6000000
        Else
            angsuran.Text = ""


        End If
        If jbeli.Text = "1" Then
            sisakeredit.Text = 500000
        ElseIf jbeli.Text = "2" Then
            sisakeredit.Text = 1000000
        ElseIf jbeli.Text = "3" Then
            sisakeredit.Text = 7000000
        ElseIf jbeli.Text = "4" Then
            sisakeredit.Text = 10000000
        ElseIf jbeli.Text = "5" Then
            sisakeredit.Text = 10000000
        Else
            sisakeredit.Text = ""
        End If


        tharga.Text = jbeli.Text * harga.Text
        komisisales.Text = 0.02 * tharga.Text
        'sisakeredit.Text = 0.02 * jbeli.Text * uangmuka.Text
        'tseluruh.Text = tharga.Text - uangmuka.Text
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'tseluruh.Text = tharga.Text - uangmuka.Text
    End Sub

    Private Sub uangmuka_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles uangmuka.KeyPress
        If Asc(e.KeyChar) = 13 Then
            sisakeredit.Text = hargakeredit.Text - uangmuka.Text
            angsuran.Text = sisakeredit.Text / lamakeredit.Text
        End If
    End Sub

    Private Sub uangmuka_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uangmuka.TextChanged

    End Sub

    Private Sub lamakeredit_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lamakeredit.SelectedIndexChanged

        If lamakeredit.Text = "12" Then
            uangmuka.Text = 4500000
        ElseIf lamakeredit.Text = "24" Then
            uangmuka.Text = 8900000
        ElseIf lamakeredit.Text = "36" Then
            uangmuka.Text = 9600000
        ElseIf lamakeredit.Text = "48" Then
            uangmuka.Text = 5600000
        ElseIf lamakeredit.Text = "60" Then
            uangmuka.Text = 8600000
        Else
            uangmuka.Text = ""

        End If

        hargakeredit.Text = tharga.Text * 0.03 + Val(tharga.Text)
    End Sub

    Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label9.Click

    End Sub

    Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
        Call IsiTabel()
        kodemobil.Focus()
        Call bersih()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()

    End Sub
End Class














3. HASIL DARI DESAIN PENJUALAN MOBIL



























4.  HASIL DARI SIMPAN:

Tidak ada komentar:

Posting Komentar