Tampilkan postingan dengan label Jawaban Soal 2 (Fizay). Tampilkan semua postingan
Tampilkan postingan dengan label Jawaban Soal 2 (Fizay). Tampilkan semua postingan

Minggu, 29 Januari 2012

Kasus Silahkan Lihat Di sini
Jawaban Soal No 2(Fizay)
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Kode.Items.Add("TS001")
        Kode.Items.Add("TS002")
        Kode.Items.Add("VG001")
        Kode.Items.Add("VG002")
        buattable()
    End Sub

    Private Sub Jumlah_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Jumlah.KeyPress
        If Asc(e.KeyChar) = 13 Then
            Total.Text = Jumlah.Text * Harga.Text
        End If
    End Sub

    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
        If Microsoft.VisualBasic.Left(Kode.Text, 2) = "TS" Then
            Merek.Text = "Thosiba"
        ElseIf Microsoft.VisualBasic.Left(Kode.Text, 2) = "VG" Then
            Merek.Text = "V-Gen"
        End If
        If Microsoft.VisualBasic.Right(Kode.Text, 3) = "001" Then
            Nama.Text = "Flashdick 4GB"
        ElseIf Microsoft.VisualBasic.Right(Kode.Text, 3) = "002" Then
            Nama.Text = "Flashdick 2GB"

        End If
        If Kode.Text = "TS001" Then
            Harga.Text = 105000
        ElseIf Kode.Text = "TS002" Then
            Harga.Text = 75000
        ElseIf Kode.Text = "VG001" Then
            Harga.Text = 90000
        ElseIf Kode.Text = "VG002" Then
            Harga.Text = 60000
        End If
    End Sub
    Sub buattable()
        LV.Columns.Add("No Pembelian", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Kode Barang", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Nama BArang", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Merek", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Harga", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
        LV.View = View.Details
        LV.FullRowSelect = True
        LV.GridLines = True
    End Sub
    Sub isi()
        Dim lst As New ListViewItem
        lst.Text = No.Text
        lst.SubItems.Add(kode.Text)
        lst.SubItems.Add(Nama.Text)
        lst.SubItems.Add(Merek.Text)
        lst.SubItems.Add(Harga.Text)
        lst.SubItems.Add(Jumlah.Text)
        lst.SubItems.Add(Total.Text)
        LV.Items.Add(lst)
    End Sub

    Private Sub BtnBersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBersih.Click
        No.Text = ""
        Kode.Text = ""
        Nama.Text = ""
        Merek.Text = ""
        Harga.Text = ""
        Jumlah.Text = ""
        Total.Text = ""
    End Sub

    Private Sub BtnData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnData.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub

    Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
        isi()
    End Sub

    Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.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
End Class