Headlines News :
Home » » Menampilkan Output Program Penjualan TV.Sony Menggunakan VB.Net 2008

Menampilkan Output Program Penjualan TV.Sony Menggunakan VB.Net 2008

Written By Unknown on Minggu, 08 Desember 2013 | 05.59


A. Rancangan Form


B. Listing Koding

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Nofaktur.Text = 1
        CekKodeTV()
    End Sub

    Sub CekKodeTV()
        For i = 1 To 3
            Kode.Items.Add("TV00" & i)
        Next
    End Sub

    Sub CeKNoFaktur()
        Dim i As String
        i = 1
        If Nofaktur.Text = 1 Then
            Nofaktur.Text = i + 1
        Else
            Nofaktur.Text = Val(i) + Val(Nofaktur.Text)
        End If
    End Sub

    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
        If Kode.Text = "TV001" Then
            Nama.Text = "TV. SONY 21 Inch"
            Harga.Text = 1500000
        ElseIf Kode.Text = "TV002" Then
            Nama.Text = "TV. SONY 29 Inch"
            Harga.Text = 1750000
        ElseIf Kode.Text = "TV003" Then
            Nama.Text = "TV. SONY 32 Inch"
            Harga.Text = 1900000
        End If
    End Sub

    Private Sub Jumlah_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Jumlah.KeyPress
        If Not ((e.KeyChar >= "0" And e.KeyChar <= "9") Or e.KeyChar = vbBack) Then
            e.Handled = True
        End If
    End Sub

    Private Sub Jumlah_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jumlah.TextChanged
        If Harga.Text = "" Then
            Exit Sub
        ElseIf Jumlah.Text = "" Then
            Exit Sub
        Else
            Total.Text = Harga.Text * Jumlah.Text
        End If

        If Total.Text > 2500000 Then
            Discount.Text = 0.1 * Total.Text
        Else
            Discount.Text = 0
        End If

        Totalbayar.Text = Val(Total.Text) - Val(Discount.Text)
    End Sub

    Private Sub BtnBersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBersih.Click
        Bersih()
    End Sub

    Sub Bersih()
        Kode.Text = ""
        Nama.Text = ""
        Harga.Text = ""
        Jumlah.Text = ""
        Total.Text = ""
        Discount.Text = ""
        Totalbayar.Text = ""
    End Sub

    Private Sub BtnTampil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTampil.Click
        MsgBox("PENJUALAN TV.SONY" & vbCrLf & "--------------------------------------------------" & _
                vbCrLf & "Nama Barang  : " & Nama.Text & vbCrLf & "Harga   : " & Harga.Text & _
                vbCrLf & "Jumlah Jual  : " & Jumlah.Text & vbCrLf & "Total Harga : " & Total.Text & _
                vbCrLf & "Discount : " & Discount.Text & vbCrLf & "Total Pembayaran : " & Totalbayar.Text & _
                vbCrLf & "--------------------------------------------------")

        Bersih()
    End Sub
End Class

C. Hasil Program







Share this post :

Posting Komentar

 
Support : Creating Website | | citrashare
Copyright © 2011. Citra Share - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger