Jawaban Tugas VB.NET bab 3

Public Class ClsGAJI
    Private noslip As String
    Private tglslip As Date
    Private gaji As Double
    Public Property nomorslip() As String
        Get
            Return noslip
        End Get
        Set(ByVal value As String)
            noslip = value
        End Set
    End Property
    Public Property tglgaji() As Date
        Get
            Return tglslip
        End Get
        Set(ByVal value As Date)
            tglslip = value
        End Set
    End Property
    Public Property gapok() As Double
        Get
            Return gaji
        End Get
        Set(ByVal value As Double)
            gaji = value

        End Set
    End Property
End Class

Public Class ClsPEGAWAI
    Private nip, nama, jabatan As String
    Private tglahir As Date
    Public Property nomor() As String
        Get
            Return nip
        End Get
        Set(ByVal value As String)
            nip = value
        End Set
    End Property
    Public Property nmpeg() As String
        Get
            Return nama
        End Get
        Set(ByVal value As String)
            nama = value
        End Set
    End Property
    Public Property jabatanpgw() As String
        Get
            Return jabatan
        End Get
        Set(ByVal value As String)
            jabatan = value
        End Set
    End Property
    Public Property tanggal() As String
        Get
            Return tglahir
        End Get
        Set(ByVal value As String)
            tglahir = value
        End Set
    End Property
End Class


Public Class FrmSlipGaji
    Dim objslip As New ClsGAJI
    Dim objPGW As New ClsPegawai
    Dim objGAJI As New ClsGAJI


    Private Sub FrmSlipGaji_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
        With CBJabatan
            .Items.Add("Director")
            .Items.Add("Manager")
            .Items.Add("Supervisor")
            .Items.Add("Officer")
            .SelectedIndex = 0


        End With
    End Sub

    Private Sub BBatal_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BBatal.Click
        TxtNoSlip.Text = ""
        DTglSlip.Value = Now
        TxtNama.Text = ""
        CBJabatan.Text = ""
        TxtGAPOK.Text = ""

    End Sub

    Private Sub BCetak_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BCetak.Click
        Dim data As String
        With objPGW
            .nmpeg = TxtNama.Text
            .jabatanpgw = CBJabatan.Text
        End With
        With objGaJI
            .nomorslip = TxtNoSlip.Text
            .tglgaji = DTglSlip.Value
            .gapok = TxtGAPOK.Text
        End With
        data = "Nomor Slip : " + objGAJI.nomorslip + Chr(13) + _
             "tanggal Slip : " + Format(objGAJI.tglgaji, "dd/MM/yyyy") + Chr(13) + _
             "Nama Pegawai : " + objPGW.nmpeg + Chr(13) + _
             "Jabatan : " + objPGW.jabatanpgw + Chr(13) + _
             "Gaji Pokok : " + Format(objGAJI.gapok, "###,###")

        MsgBox(data, MsgBoxStyle.OkOnly, "Data Slip Pegawai")

    End Sub
End Class

0 komentar:

Posting Komentar