Home » , » Program Vb.Net 2008 Menggunakan Fungsi Case

Program Vb.Net 2008 Menggunakan Fungsi Case



Contoh Program Pegawai menggunakan Case awaq ...
heheheheh .....
Listing Programs >>

Public Class form_pegawai
    Dim x, y As String
    Dim a As String
    Dim c As String
    Dim b As MsgBoxResult

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        For i = 1 To 8
            cmb_nip.Items.Add("10123300" & i)
        Next
    End Sub

    Sub seleksi()
        a = "Pak"
        c = "Gol"
        x = Microsoft.VisualBasic.Right(cmb_nip.Text, 3)
        Select Case x
            Case "001" : Txt_nama.Text = a & " " & "Mesran" : cmb_gol.Items.Add(c & " " & "IVA")
            Case "002" : Txt_nama.Text = a & " " & "Abdul" : cmb_gol.Items.Add(c & " " & "I")
            Case "003" : Txt_nama.Text = a & " " & "Berto" : cmb_gol.Items.Add(c & " " & "I")
            Case "004" : Txt_nama.Text = a & " " & "Paska" : cmb_gol.Items.Add(c & " " & "I")
            Case "005" : Txt_nama.Text = a & " " & "Toni" : cmb_gol.Items.Add(c & " " & "IIIB")
            Case "006" : Txt_nama.Text = a & " " & "Yasir" : cmb_gol.Items.Add(c & " " & "IIIC")
            Case "007" : Txt_nama.Text = a & " " & "Fahmy" : cmb_gol.Items.Add(c & " " & "I")
            Case "008" : Txt_nama.Text = a & " " & "Lambok" : cmb_gol.Items.Add(c & " " & "I")
        End Select
    End Sub
    Private Sub cmb_nip_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_nip.SelectedIndexChanged
        Call bersih()
        Call seleksi()
    End Sub
    Sub bersih()
        cmb_gol.Items.Clear()
        cmb_gol.Text = ""
        cmb_jabatan.Items.Clear()
        cmb_jabatan.Text = ""
        txt_tunjangan.Text = ""
        txt_gaji.Text = ""
    End Sub
    Sub bersih(ByVal f As Form)
        Dim x As Object
        For Each x In f.Controls
            If TypeOf x Is TextBox Then x.text = ""
            If TypeOf x Is ComboBox Then x.text = ""
        Next
    End Sub

    Private Sub Btn_bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_bersih.Click
        Call bersih()
        Call bersih(Me)
    End Sub
    Private Sub cmb_gol_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_gol.SelectedIndexChanged
        x = Microsoft.VisualBasic.Right(cmb_gol.Text, 1)
        Select Case x
            Case "A" : txt_gaji.Text = 5000000 : cmb_jabatan.Items.Add("Ketua")
            Case "B" : txt_gaji.Text = 3500000 : cmb_jabatan.Items.Add("PuketI")
            Case "C" : txt_gaji.Text = 2500000 : cmb_jabatan.Items.Add("PuketII")
            Case "I" : txt_gaji.Text = 2000000 : cmb_jabatan.Items.Add("Dosen")
        End Select
    End Sub

    Private Sub cmb_jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_jabatan.SelectedIndexChanged
        y = Microsoft.VisualBasic.Left(cmb_jabatan.Text, 5)
        Select Case y
            Case "Ketua" : txt_tunjangan.Text = 1800000
            Case "Puket" : txt_tunjangan.Text = 1400000
            Case "Dosen" : txt_tunjangan.Text = 1000000
        End Select
    End Sub

    Private Sub Btn_Proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Proses.Click
        txt_tolgaji.Text = "Rp" & " " & Val(txt_gaji.Text) + Val(txt_tunjangan.Text)
    End Sub

    Private Sub Btn_keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_keluar.Click

        b = MsgBox("Apa anda Yakin keluar dari program ini?", MsgBoxStyle.Question + _
            MsgBoxStyle.YesNo, "Program Pegawai")
        If b = MsgBoxResult.Yes Then
            Close()
        End If
    End Sub

End Class

<> Semoga Dapata Bermanfaat <>


Share this article :

0 komentar:

Posting Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2012. Q Hanya Butuh Kesetia'an - All Rights Reserved
Template Modify by Raikage Wahyu
Powered by Blogger