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

Minggu, 08 Desember 2013

contoh program Cb.net sederhana



di bawah ini adalah cara gimana untuk membuat program seperti di atas!!
selamat mencoba..


Public Class Form2


    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        NPM.Items.Add("12110298")
        NPM.Items.Add("13111057")
        NPM.Items.Add("12111009")
        NPM.Items.Add("10111077")

        KodeDosen.Items.Add("982")
        KodeDosen.Items.Add("973")
        KodeDosen.Items.Add("957")
        KodeDosen.Items.Add("999")


        KodeMatakuliah.Items.Add("A23")
        KodeMatakuliah.Items.Add("A24")
        KodeMatakuliah.Items.Add("A25")
        KodeMatakuliah.Items.Add("A26")
        KodeMatakuliah.Items.Add("A27")
        KodeMatakuliah.Items.Add("A28")
        KodeMatakuliah.Items.Add("A29")


        Dim i As Byte
        For i = 1 To 100
            NilaiKehadiran.Items.Add(i)
            NilaiTugas.Items.Add(i)
            NilaiUTS.Items.Add(i)
            NilaiUAS.Items.Add(i)
        Next
    End Sub

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

        Select Case NPM.Text
            Case "12110298"
                Nama.Text = "benny syahputra"
            Case "13111057"
                Nama.Text = "eko juliansyah"
            Case "12111009"
                Nama.Text = "Rio"
            Case "10111077"
                Nama.Text = "Jayen"
        End Select

        Select Case x
            Case "131"
                Jenjang.Text = "DII"
            Case "121"
                Jenjang.Text = "S1"
            Case "121"
                Jenjang.Text = "S1"
            Case "101"
                Jenjang.Text = "DIII"
            Case Else
                Jenjang.Text = "_"
        End Select

        Select Case y
            Case "298"
                Jurusan.Text = "Teknik Informatika"
            Case "057"
                Jurusan.Text = "Managemen informatika"
            Case "009"
                Jurusan.Text = "Sistem Informasi"
            Case "077"
                Jurusan.Text = "Manajemen informatika"
            Case Else
                Jurusan.Text = "_"
        End Select
    End Sub

    Private Sub KodeDosen_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KodeDosen.SelectedIndexChanged
        Select Case KodeDosen.Text
            Case "982"
                NamaDosen.Text = "M.Syahrizal, M.kom"
            Case "973"
                NamaDosen.Text = "Mesran S.Kom,M.Kom"
            Case "957"
                NamaDosen.Text = "Hotman S.kom"
            Case "999"
                NamaDosen.Text = "Yasir M.kom"
            Case Else
                NamaDosen.Text = "_"
        End Select
    End Sub

    Private Sub Btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnproses.Click
        NilaiAkhir.Text = 0.4 * NilaiUTS.Text + 0.6 * NilaiUAS.Text + 0.1 * NilaiKehadiran.Text + 0.15 * NilaiTugas.Text

        If NilaiAkhir.Text >= 80 Then
            NilaiHuruf.Text = "A"
        ElseIf NilaiAkhir.Text >= 70 Then
            NilaiHuruf.Text = "B"
        ElseIf NilaiAkhir.Text >= 60 Then
            NilaiHuruf.Text = "C"
        ElseIf NilaiAkhir.Text >= 50 Then
            NilaiHuruf.Text = "D"
        Else
            NilaiHuruf.Text = "E"
        End If

        If NilaiAkhir.Text >= 50 Then
            Keterangan.Text = "Lulus"
        Else
            Keterangan.Text = "Gagal"
        End If

        If Jenjang.Text = "1" Then
            Jenjang.Text = "Diploma 1"
        ElseIf Jenjang.Text = "3" Then
            Jenjang.Text = "Diploma 3"
        ElseIf Jenjang.Text = "4" Then
            Jenjang.Text = "Strata 1"
        End If

        If Jurusan.Text = "01" Then
            Jurusan.Text = "Manajemen Informatika"
        ElseIf Jurusan.Text = "02" Then
            Jurusan.Text = "Sistem Informatika"
        ElseIf Jurusan.Text = "03" Then
            Jurusan.Text = "Teknik komputer"
        ElseIf Jurusan.Text = "04" Then
            Jurusan.Text = "Akuntansi"
        End If
    End Sub

    Private Sub Btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapus.Click
        NPM.Text = ""
        Nama.Text = ""
        Jenjang.Text = ""
        Jurusan.Text = ""
        KodeDosen.Text = ""
        NamaDosen.Text = ""
        KodeMatakuliah.Text = ""
        NamaMatakuliah.Text = ""
        NilaiKehadiran.Text = ""
        NilaiTugas.Text = ""
        NilaiUTS.Text = ""
        NilaiUAS.Text = ""
        NilaiAkhir.Text = ""
        NilaiHuruf.Text = ""
        Keterangan.Text = ""
    End Sub
    Private Sub NilaiUAS_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles NilaiUAS.KeyPress
        Dim tombol As Integer = Asc(e.KeyChar)
        If tombol = 13 Then
            Btnproses_Click(sender, e)
        End If
    End Sub

    Private Sub KodeMatakuliah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KodeMatakuliah.SelectedIndexChanged
        Select Case KodeMatakuliah.Text
            Case "A23"
                NamaMatakuliah.Text = "Sistem Basis data"
            Case "A24"
                NamaMatakuliah.Text = "matriks linier transformasi"
            Case "A25"
                NamaMatakuliah.Text = "Programan visual"
            Case "A26"
                NamaMatakuliah.Text = "Teknik Informatika"
            Case "A27"
                NamaMatakuliah.Text = "Managemen Sistem"
            Case "A28"
                NamaMatakuliah.Text = "teknik digital"
            Case "A29"
                NamaMatakuliah.Text = "visual basic"
            Case Else
                NamaMatakuliah.Text = "_"
        End Select
    End Sub

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

    Private Sub NilaiUAS_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NilaiUAS.SelectedIndexChanged

    End Sub
End Class


link pak mesran