Minggu, 02 Juni 2013

YUK BELAJAR PEMROGRAMAN VISUAL BASIC DOT NET DI MESRAN.NET


Public Class Form1

    Private Sub kdbar_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kdbar.SelectedIndexChanged
        Dim x As String
        x = Microsoft.VisualBasic.Left(kdbar.Text, 2)
        Select Case x
            Case "TS" : merk.Text = "TOSHIBA"
            Case "VG" : merk.Text = "V-GEN"
        End Select

        Dim I As String
        I = Microsoft.VisualBasic.Right(kdbar.Text, 3)
        Select Case I
            Case "001" : nabar.Text = "FLASHDISK 4GB"
            Case "002" : nabar.Text = "FLASHDISK 2GB"
        End Select

        If x = "TS" And I = "001" Then
            harga.Text = 105000
        ElseIf x = "TS" And I = "002" Then
            harga.Text = 75000
        ElseIf x = "VG" And I = "001" Then
            harga.Text = 90000
        ElseIf x = "VG" And I = "002" Then
            harga.Text = 60000

        End If
    End Sub

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


        buatTabel()
    End Sub
    Sub bersih()
        nopem.Text = ""
        kdbar.Text = ""
        merk.Text = ""
        harga.Text = ""
        tohar.Text = ""
        jumbel.Text = ""
        nabar.Text = ""

    End Sub

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

    End Sub


    Private Sub btnproses_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        tohar.Text = harga.Text * jumbel.Text
    End Sub

    Private Sub btnhapus2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus2.Click
        nopem.Text = ""
        kdbar.Text = ""
        jumbel.Text = ""
    End Sub

    Private Sub btnhapus1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus1.Click
        nopem.Text = ""
        kdbar.Text = ""
        merk.Text = ""
        harga.Text = ""
        tohar.Text = ""
        jumbel.Text = ""
        nabar.Text = ""
    End Sub

    Private Sub LV_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LV.SelectedIndexChanged
    End Sub

    Sub buatTabel()

        LV.Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Kode Barang", 180, HorizontalAlignment.Left)
        LV.Columns.Add("Nama Barang", 180, HorizontalAlignment.Left)
        LV.Columns.Add("Merk", 180, HorizontalAlignment.Left)
        LV.Columns.Add("Harga", 180, HorizontalAlignment.Left)
        LV.Columns.Add("Jumlah Beli", 180, HorizontalAlignment.Left)
        LV.Columns.Add("Total Harga", 180, HorizontalAlignment.Left)
        LV.View = View.Details
        LV.GridLines = True
        LV.FullRowSelect = True

    End Sub


    Sub isiTabel()
        Dim lst As New ListViewItem
        lst.Text = nopem.Text
        lst.SubItems.Add(kdbar.Text)
        lst.SubItems.Add(nabar.Text)
        lst.SubItems.Add(merk.Text)
        lst.SubItems.Add(harga.Text)
        lst.SubItems.Add(jumbel.Text)
        lst.SubItems.Add(tohar.Text)
        LV.Items.Add(lst)

    End Sub


    Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
        isiTabel()
        nopem.Text = ""
        kdbar.Text = ""
        nabar.Text = ""
        merk.Text = ""
        harga.Text = ""
        jumbel.Text = ""
        tohar.Text = ""
    End Sub
End Class


Demikianlh postingan saya :
nama : Nur febrina sari baizuri
npm :1111035




Tidak ada komentar:

Posting Komentar