RSS

LATIHAN VB 2008

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        nik.Items.Add("PM010")
        nik.Items.Add("PS111")
        nik.Items.Add("KU101")
        nik.Items.Add("GD100")
        nik.Items.Add("PM011")

        jabatan.Items.Add("Kepala Divisi")
        jabatan.Items.Add("Staff")
        jabatan.Items.Add("Wakil Kepala")

        status.Items.Add("Menikah")
        status.Items.Add("Tidak Menikah")

        Dim d As Integer
        For d = 0 To 10
            ja.Items.Add(d)
        Next
    End Sub


    Private Sub nik_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nik.SelectedIndexChanged
        Dim n As String
        n = Microsoft.VisualBasic.Left(nik.Text, 2)
        If n = "PM" Then
            bagian.Text = "Pemasokan"
            nama.Text = "Yulia"
        ElseIf n = "PS" Then
            bagian.Text = "Personalia"
            nama.Text = "Boy"
        ElseIf n = "KU" Then
            bagian.Text = "Keuangan"
            nama.Text = "Deasy"
        Else
            bagian.Text = "Gudang"
            nama.Text = "Rudi"
        End If
    End Sub

    Private Sub jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jabatan.SelectedIndexChanged
        If jabatan.Text = "Kepala Divisi" Then
            gapok.Text = "5000000"
            pajak.Text = 0.1 * gapok.Text
        ElseIf jabatan.Text = "Staff" Then
            gapok.Text = "2000000"
            pajak.Text = 0.1 * gapok.Text
        Else
            gapok.Text = "3500000"
            pajak.Text = 0.1 * gapok.Text
        End If
    End Sub

    Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
        If status.Text = "Menikah" Then
            tunjk.Text = 0.15 * gapok.Text
        Else
            tunjk.Text = 0
        End If
    End Sub
    Private Sub ja_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ja.SelectedIndexChanged
        If ja.Text = "1" Then
            tunja.Text = 0.05 * gapok.Text
        ElseIf ja.Text = "2" Then
            tunja.Text = 0.1 * gapok.Text
        Else
            tunja.Text = 0
        End If

        total.Text = Val(gapok.Text) + Val(tunjk.Text) + Val(tunja.Text) - Val(pajak.Text)

    End Sub

    Private Sub Buttonhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonhapus.Click
        nik.Text = ""
        nama.Text = ""
        bagian.Text = ""
        jabatan.Text = ""
        gapok.Text = ""
        pajak.Text = ""
        status.Text = ""
        ja.Text = ""
        tunjk.Text = ""
        tunja.Text = ""
        total.Text = ""
    End Sub

    Private Sub Buttonkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonkeluar.Click
        Dim tanya As String
        tanya = MsgBox("Apakah Anda Yakin Mau Keluar", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
        If tanya = vbYes Then
            Me.Close()
        Else
            Exit Sub
        End If
    End Sub
End Class























Public Class Form2
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        npm.Items.Add("12110176")
        npm.Items.Add("12111033")
        npm.Items.Add("12110082")

        kd.Items.Add("MS")
        kd.Items.Add("TL")
        kd.Items.Add("KS")

        kmk.Items.Add("KBTI4202")
        kmk.Items.Add("KKTI4203")
        kmk.Items.Add("PKTI4201")

        Dim N As Integer
        For N = 1 To 100
            nk.Items.Add(N)
            nt.Items.Add(N)
            nu.Items.Add(N)
            n_u.Items.Add(N)
        Next

    End Sub

    Private Sub npm_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.SelectedIndexChanged
        If npm.Text = "12110176" Then
            nama.Text = "Deasy"
            jenjang.Text = "S1"
            jurusan.Text = "Teknik Informatika"
        ElseIf npm.Text = "12111033" Then
            nama.Text = "Yulia Dwi Santika"
            jenjang.Text = "DIII"
            jurusan.Text = "Komputerisasi Akuntansi"
        Else
            nama.Text = "Nur Fatiah"
            jenjang.Text = "DI"
            jurusan.Text = "Desain Grafis"
        End If
    End Sub

    Private Sub kd_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kd.SelectedIndexChanged
        If kd.Text = "MS" Then
            nd.Text = "Mesran M.Kom"
        ElseIf kd.Text = "TL" Then
            nd.Text = "Toni Limbong,S.Kom,M.Kom"
        Else
            nd.Text = "Kristian Siregar,S.Kom"
        End If
    End Sub

    Private Sub kmk_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kmk.SelectedIndexChanged
        If kmk.Text = "KKTI4203" Then
            mk.Text = "Vb.Net"
        ElseIf kmk.Text = "KBTI4202" Then
            mk.Text = "Konsep Pemograman"
        Else
            mk.Text = "Pemograman HTML"
        End If
    End Sub

    Private Sub Buttonproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonproses.Click
        If na.Text = "" Then
            na.Text = 0.1 * nk.Text + 0.15 * nt.Text + 0.3 * nu.Text + 0.45 * n_u.Text
            na.Focus()
        End If
        If na.Text >= 50 Then
            ket.Text = "Lulus"
        Else
            ket.Text = "Gagal"
        End If
        If na.Text >= 80 Then
            nh.Text = "A"
        ElseIf na.Text >= 70 Then
            nh.Text = "B"
        ElseIf na.Text >= 60 Then
            nh.Text = "C"
        ElseIf na.Text >= 50 Then
            nh.Text = "D"
        Else
            nh.Text = "E"
        End If
    End Sub
    Private Sub Buttonhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonhapus.Click
        npm.Text = ""
        nama.Text = ""
        jenjang.Text = ""
        jurusan.Text = ""
        kd.Text = ""
        nd.Text = ""
        kmk.Text = ""
        mk.Text = ""
        nk.Text = ""
        nt.Text = ""
        nu.Text = ""
        n_u.Text = ""
        na.Text = ""
        nh.Text = ""
        ket.Text = ""
    End Sub

    Private Sub Buttonkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonkeluar.Click
        Dim tanya As String
        tanya = MsgBox("Apakah Anda Yakin Mau Keluar", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
        If tanya = vbYes Then
            Me.Close()
        Else
            Exit Sub
        End If
    End Sub
End Class



















Public Class Form1

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

    End Sub

    Private Sub kd_brg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kd_brg.SelectedIndexChanged
        Dim x As String
        Dim y As String
        x = Microsoft.VisualBasic.Left(kd_brg.Text, 2)
        If x = "TS" Then
            merk.Text = "Toshiba"
        ElseIf x = "VG" Then
            merk.Text = "V-gen"
        End If
        y = Microsoft.VisualBasic.Right(kd_brg.Text, 3)
        If y = "001" Then
            Nm_brg.Text = "Flashdisk 4GB"
        Else
            Nm_brg.Text = "Flashdisk 2GB"

        End If
    End Sub
End Class




  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 komentar:

Posting Komentar