Senin, 16 Desember 2013

Tugas Quiz





Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        KP.Items.Add("TOK-MED-100")
        KP.Items.Add("PAB-TAN-101")
        KP.Items.Add("SWA-TAN-102")
        KP.Items.Add("PAB-MED-103")
        KP.Items.Add("RUM-MED-104")
    End Sub

    Private Sub KP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KP.SelectedIndexChanged
        Dim x As String
        x = Microsoft.VisualBasic.Right(KP.Text, 3)



        If x = "100" Then
            nama.Text = "eko juliansyah"
        ElseIf x = "101" Then
            nama.Text = "jaya "
        ElseIf x = "102" Then
            nama.Text = "Melani"
        ElseIf x = "103" Then
            nama.Text = "Andre"
        End If


        x = Microsoft.VisualBasic.Left(KP.Text, 3)

        If x = "PAB" Then
            HargaM3.Text = 500
            BBeban.Text = 250000
            Tipe.Text = "Pabrik"
        ElseIf x = "TOK" Then
            HargaM3.Text = 500
            BBeban.Text = 25000
            Tipe.Text = "Toko"
        ElseIf x = "RUM" Then
            HargaM3.Text = 500
            BBeban.Text = 10000
            Tipe.Text = "Rumah"
        ElseIf x = "SWA" Then
            HargaM3.Text = 200
            BBeban.Text = 15000
            Tipe.Text = "Swalayan"
        End If

        x = Microsoft.VisualBasic.Mid(KP.Text, 5, 3)
        If x = "MED" Then
            Daerah.Text = "Medan"
        ElseIf x = "TAN" Then
            Daerah.Text = "Tanjung"
        End If
    End Sub

    Private Sub Pemakaian_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Pemakaian.KeyPress
        If Asc(e.KeyChar) = 13 Then
            TTagihan.Text = HargaM3.Text * Pemakaian.Text + Val(BBeban.Text)
            Pajak.Text = 0.01 * TTagihan.Text
            Pembayaran.Text = Val(TTagihan.Text) + Val(Pajak.Text)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        End
    End Sub

    Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
        KP.Text = ""
        Nama.Text = ""
        Tipe.Text = ""
        TTagihan.Text = ""
        HargaM3.Text = ""
        Pajak.Text = ""
        Pembayaran.Text = ""
        Pemakaian.Text = ""
        Daerah.Text = ""
        BBeban.Text = ""
    End Sub
End Class

tugas: mesran

Tidak ada komentar:

Posting Komentar