ChEMunguth

ChEMunguth

Jumat, 21 Desember 2012

CONTOH

CONTOH



PrivateSub DATAPENJUALANToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DATAPENJUALANToolStripMenuItem.Click
        Form2.Show()
Me.WindowState = FormWindowState.Minimized
end sub

Programnya:
PublicClass Form2

PrivateSub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
        faktur.Items.Add("001-TOYAVZ13")
        faktur.Items.Add("001-TOYINO15")
        faktur.Items.Add("002-TOYAVZ15")
        faktur.Items.Add("002-TOYINO20")
        faktur.Items.Add("001-HONRII01")
        faktur.Items.Add("001-HONTIG11")
        faktur.Items.Add("002-HONMED14")
        faktur.Items.Add("002-SUZKIN07")
        faktur.Items.Add("002-SUZARE09")
        faktur.Items.Add("002-SUZPAN12")
        tahun.Items.Add("2001")
        tahun.Items.Add("2002")
        tahun.Items.Add("2003")
        tahun.Items.Add("2004")
        tahun.Items.Add("2005")
        tahun.Items.Add("2006")
        tahun.Items.Add("2007")
        tahun.Items.Add("2008")
        tahun.Items.Add("2009")
        tahun.Items.Add("2010")
        tahun.Items.Add("2011")
        tahun.Items.Add("2012")
        tahun.Items.Add("2013")
        tahun.Items.Add("2014")
        tahun.Items.Add("2015")
        jumlahbeli.Items.Add("1")
        jumlahbeli.Items.Add("2")
        jumlahbeli.Items.Add("3")
        jumlahbeli.Items.Add("4")
        jumlahbeli.Items.Add("5")
        Lama.Items.Add("1 Tahun")
        Lama.Items.Add("2 Tahun")
        Lama.Items.Add("3 Tahun")
        Lama.Items.Add("4 Tahun")
        Lama.Items.Add("5 Tahun")





Call Buat_table()
EndSub

Sub Buat_table()
        LV.GridLines = True
        LV.View = View.Details
        LV.FullRowSelect = True
        LV.Columns.Add("Merek Mobil")
        LV.Columns.Add("Tipe")
        LV.Columns.Add("Harga")
        LV.Columns.Add("Tahun")
        LV.Columns.Add("Jumlah Beli")
        LV.Columns.Add("DP")
        LV.Columns.Add("Lama")
        LV.Columns.Add("Cicilan")


EndSub

PrivateSub faktur_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles faktur.SelectedIndexChanged
Dim X AsString
        X = Microsoft.VisualBasic.Mid(faktur.Text, 5, 3)
SelectCase X
Case"TOY"
                merek.Text = "TOYOTA"
Case"HON"
                merek.Text = "HONDA"

Case"SUZ"
                merek.Text = "SUZUKY"
EndSelect
If Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "AVZ"Then
            tipe.Text = "AVANZA"
ElseIf Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "INO"Then
            tipe.Text = "INOVA"
ElseIf Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "RII"Then
            tipe.Text = "REPUBLIK"
ElseIf Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "TIG"Then
            tipe.Text = "TIGER"
ElseIf Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "MED"Then
            tipe.Text = "MEDAN"
ElseIf Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "KIN"Then
            tipe.Text = "KING"
ElseIf Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "ARE"Then
            tipe.Text = "ARENA"
ElseIf Microsoft.VisualBasic.Mid(faktur.Text, 8, 3) = "PAN"Then
            tipe.Text = "PANTER"
EndIf

        tahun.Text = "20"& Microsoft.VisualBasic.Right(faktur.Text, 2)



EndSub

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

EndSub

PrivateSub merek_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles merek.TextChanged
If merek.Text = "TOYOTA"Then
            dp.Text = 20000000
ElseIf merek.Text = "HONDA"Then
            dp.Text = 25000000
ElseIf merek.Text = "SUZUKY"Then
            dp.Text = 30000000

EndIf

EndSub

PrivateSub btnmasuk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmasuk.Click
Dim LST AsNew ListViewItem
        LST.Text = merek.Text
        LST.SubItems.Add(tipe.Text)
        LST.SubItems.Add(harga.Text)
        LST.SubItems.Add(tahun.Text)
        LST.SubItems.Add(jumlahbeli.Text)
        LST.SubItems.Add(dp.Text)
        LST.SubItems.Add(Lama.Text)
        LST.SubItems.Add(cicilan.Text)
        LV.Items.Add(LST)
EndSub

PrivateSub Btnhapuslist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapuslist.Click
        LV.Items.Clear()
EndSub

PrivateSub btnhpsrecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhpsrecord.Click
        LV.Items.Remove(LV.SelectedItems(0))
EndSub

PrivateSub tipe_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tipe.TextChanged
If tipe.Text = "AVANZA"Then
            harga.Text = 100000000
ElseIf tipe.Text = "INOVA"Then
            harga.Text = 110000000
ElseIf tipe.Text = "REPUBLIK"Then
            harga.Text = 115000000
ElseIf tipe.Text = "TIGER"Then
            harga.Text = 116000000
ElseIf tipe.Text = "MEDAN"Then
            harga.Text = 117000000
ElseIf tipe.Text = "KING"Then
            harga.Text = 118000000
ElseIf tipe.Text = "ARENA"Then
            harga.Text = 119000000
ElseIf tipe.Text = "PANTER"Then
            harga.Text = 12000000
EndIf
EndSub

PrivateSub Lama_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lama.SelectedIndexChanged
If Lama.Text = "1 Tahun"Then
            cicilan.Text = harga.Text - dp.Text
ElseIf Lama.Text = "2 Tahun"Then
            cicilan.Text = harga.Text - dp.Text
ElseIf Lama.Text = "3 Tahun"Then
            cicilan.Text = harga.Text - dp.Text
ElseIf Lama.Text = "4 Tahun"Then
            cicilan.Text = harga.Text - dp.Text
ElseIf Lama.Text = "5 Tahun"Then
            cicilan.Text = harga.Text - dp.Text
EndIf
EndSub
EndClass

Tidak ada komentar:

Posting Komentar