Minggu, 29 Januari 2012

Jawaban Quis No 3

click in here !!

Form1

 ketikkan program berikut:
Public Class Login

    Private Sub btnmasuk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmasuk.Click
        If username.Text = "Mangasido" And password.Text = "0911876" Then
            MenuUtama.Show()
            Me.Hide()
        Else
            MsgBox("USERNAME / PASSWORD SALAH !")
            username.Text = ""
            password.Text = ""
        End If
    End Sub

    Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
        End
    End Sub
End Class
 
Form2

ketikkan program berikut:
Public Class MenuUtama

    Private Sub DataPembayaranPDAMToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataPembayaranPDAMToolStripMenuItem1.Click
        TagihanPDAM.Show()
    End Sub

    Private Sub KeluarToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KeluarToolStripMenuItem1.Click
        End
    End Sub
End Class

Form3

ketikkan program berikut:
Public Class TagihanPDAM

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        Dim x As String
        x = Microsoft.VisualBasic.Left(kodepelanggan.Text, 3)
        If x = "TOK" Then
            tipepelanggan.Text = "TOKO"
            biayabeban.Text = 25000
            hargaperm3.Text = 300
        ElseIf x = "RUM" Then
            tipepelanggan.Text = "RUMAH"
            biayabeban.Text = 15000
            hargaperM3.Text = 100
        ElseIf x = "SWA" Then
            tipepelanggan.Text = "SWALAYAN"
            biayabeban.Text = 10000
            hargaperM3.Text = 200
        ElseIf x = "PAB" Then
            tipepelanggan.Text = "PABRIK"
            biayabeban.Text = 25000
            hargaperM3.Text = 500
        End If

        x = Microsoft.VisualBasic.Mid(kodepelanggan.Text, 4, 1)
        If x = "-" Then
        End If

        x = Microsoft.VisualBasic.Mid(kodepelanggan.Text, 5, 3)
        If x = "MED" Then
            daerahpelanggan.Text = "MEDAN"
        ElseIf x = "BEL" Then
            daerahpelanggan.Text = "BELAWAN"
        ElseIf x = "TEM" Then
            daerahpelanggan.Text = "AKSARA"
        ElseIf x = "MAR" Then
            daerahpelanggan.Text = "MARENDAL"
        ElseIf x = "BIN" Then
            daerahpelanggan.Text = "BINJAI"
        ElseIf x = "PAK" Then
            daerahpelanggan.Text = "LUBUK-PAKAM"
        End If

        x = Microsoft.VisualBasic.Mid(kodepelanggan.Text, 8, 1)
        If x = "-" Then
        End If
        nourut.Text = Microsoft.VisualBasic.Mid(kodepelanggan.Text, 9, 3)
        totaltagihan.Text = Val(biayabeban.Text) + Val(hargaperM3.Text) * Val(jumlahpemakaian.Text)
        totaltagihanPPN.Text = (0.01) * Val(totaltagihan.Text) + Val(totaltagihan.Text)
    End Sub

    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        kodepelanggan.Text = ""
        daerahpelanggan.Text = ""
        tipepelanggan.Text = ""
        biayabeban.Text = ""
        hargaperM3.Text = ""
        jumlahpemakaian.Text = ""
        totaltagihan.Text = ""
        totaltagihanPPN.Text = ""
        nourut.Text = ""
    End Sub

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

HASIL DEBUG


Sabtu, 28 Januari 2012

Soal Quis no. 2 Modul Hal 33

http://mesran.wordpress.com/2012/01/26/soal-quiz-online-hari-selasa-2/

Design awal



Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        kodebarang.Items.Add("TS001")
        kodebarang.Items.Add("TS002")
        kodebarang.Items.Add("VG001")
        kodebarang.Items.Add("VG002")
        buattabel()
    End Sub

    Private Sub kodebarang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kodebarang.SelectedIndexChanged
        Dim x As String
        x = Microsoft.VisualBasic.Left(kodebarang.Text, 2)
        If x = "TS" Then
            merk.Text = "Toshiba"
        ElseIf x = "VG" Then
            merk.Text = "V-Gen"
        End If
        x = Microsoft.VisualBasic.Right(kodebarang.Text, 3)
        If x = "001" Then
            namabarang.Text = "Flashdisk 4GB"
        ElseIf x = "002" Then
            namabarang.Text = "Flashdisk 2GB"
        End If
        If kodebarang.Text = "TS001" Then
            harga.Text = "105000"
        ElseIf kodebarang.Text = "TS002" Then
            harga.Text = "75000"
        ElseIf kodebarang.Text = "VG001" Then
            harga.Text = "90000"
        ElseIf kodebarang.Text = "VG002" Then
            harga.Text = "60000"
        End If
    End Sub

    Private Sub jumlahbeli_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumlahbeli.KeyPress
        Dim tombol As Integer = Asc(e.KeyChar)
        If tombol = 13 Then
            btnproses_Click(sender, e)
        End If
    End Sub

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        totalharga.Text = Val(jumlahbeli.Text) * Val(harga.Text)
    End Sub
    Sub buattabel()
        With LV
            .Columns.Add("Nomor Pembelian", 100, HorizontalAlignment.Center)
            .Columns.Add("Kode Barang", 100, HorizontalAlignment.Left)
            .Columns.Add("Nama Barang", 100, HorizontalAlignment.Left)
            .Columns.Add("Merk", 110, HorizontalAlignment.Left)
            .Columns.Add("Harga", 110, HorizontalAlignment.Left)
            .Columns.Add("Jumlah Beli", 110, HorizontalAlignment.Left)
            .Columns.Add("Total Harga", 120, HorizontalAlignment.Center)
            .View = View.Details
            .GridLines = True
            .FullRowSelect = True
        End With
    End Sub

    Sub isitabel()
        Dim lst As New ListViewItem
        lst.Text = nopembelian.Text
        lst.SubItems.Add(kodebarang.Text)
        lst.SubItems.Add(namabarang.Text)
        lst.SubItems.Add(merk.Text)
        lst.SubItems.Add(harga.Text)
        lst.SubItems.Add(jumlahbeli.Text)
        lst.SubItems.Add(totalharga.Text)
        LV.Items.Add(lst)
    End Sub
    Sub clean()
        nopembelian.Text = ""
        kodebarang.Text = ""
        namabarang.Text = ""
        merk.Text = ""
        harga.Text = ""
        jumlahbeli.Text = ""
        totalharga.Text = ""
    End Sub

    Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
        Call clean()
    End Sub

    Private Sub btnhapusdatayangdipilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapusdatayangdipilih.Click
        If LV.SelectedItems.Count <> 0 Then
            LV.Items.Remove(LV.SelectedItems(0))
        Else
            MsgBox("PILIH DATA YANG INGIN DIHAPUS !")
        End If
    End Sub

    Private Sub btnsimpankelistview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpankelistview.Click
        Call isitabel()
        Call buattabel()
        Call clean()
    End Sub

    Private Sub btnhapussemuadata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapussemuadata.Click
        LV.Items.Clear()
    End Sub

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








Hasil tampilan

Senin, 10 Oktober 2011