The Sims 3 - New Real House

Pemrograman 6

Nama TextBox 1 : nip
Nama TextBox 2 : nama
Nama TextBox 3 : gapok
Nama TextBox 4 : NJ
Nama TextBox 5 : TJ
Nama TextBox 6 : TI
Nama TextBox 7 : JA
Nama TextBox 8 : TA
Nama TextBox 9 : gaber
Nama ComboBox 1 : gol
Nama ComboBox 2 : KJ
Nama CheckBox 1 : pria
Nama CheckBox 1 : wanita
Nama RadioButton 1 : belum
Nama RadioButton 2 : nikah
Nama RadioButton 3 : duda
Nama RadioButton 4 : janda


Syntack
Public Class Kasus_6

    Private Sub gol_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles gol.Click
        If gol.Text = "III/A" Then
            gapok.Text = 800000
        ElseIf gol.Text = "III/B" Then
            gapok.Text = 900000
        ElseIf gol.Text = "IV/A" Then
            gapok.Text = 1000000
        ElseIf gol.Text = "IV/B" Then
            gapok.Text = 1500000
        Else
            gapok.Text = 0
        End If
    End Sub

    Private Sub gol_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gol.SelectedIndexChanged
        If gol.Text = "III/A" Then
            gapok.Text = 800000
        ElseIf gol.Text = "III/B" Then
            gapok.Text = 900000
        ElseIf gol.Text = "IV/A" Then
            gapok.Text = 1000000
        ElseIf gol.Text = "IV/B" Then
            gapok.Text = 1500000
        Else
            gapok.Text = 0
        End If
    End Sub

    Private Sub KJ_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles KJ.Click
        If KJ.Text = "Kadin" Then
            NJ.Text = "Kepala Dinas"
            TJ.Text = 1000000
        ElseIf KJ.Text = "Wakadin" Then
            NJ.Text = "Wakil Kepala Dinas"
            TJ.Text = 800000
        ElseIf KJ.Text = "Kabid" Then
            NJ.Text = "Kepala Bidang"
            TJ.Text = 750000
        ElseIf KJ.Text = "Kasubag" Then
            NJ.Text = "Kepala Sub Bagian"
            TJ.Text = 600000
        Else
            NJ.Text = "-"
            TJ.Text = 0
        End If
    End Sub

    Private Sub KJ_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KJ.SelectedIndexChanged
        If KJ.Text = "Kadin" Then
            NJ.Text = "Kepala Dinas"
            TJ.Text = 1000000
        ElseIf KJ.Text = "Wakadin" Then
            NJ.Text = "Wakil Kepala Dinas"
            TJ.Text = 800000
        ElseIf KJ.Text = "Kabid" Then
            NJ.Text = "Kepala Bidang"
            TJ.Text = 750000
        ElseIf KJ.Text = "Kasubag" Then
            NJ.Text = "Kepala Sub Bagian"
            TJ.Text = 600000
        Else
            NJ.Text = "-"
            TJ.Text = 0
        End If
    End Sub

    Private Sub pria_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pria.CheckedChanged
        If pria.Checked = True And nikah.Checked = True Then
            TI.Text = Val(gapok.Text) * 0.25
            JA.Enabled = True
            TA.Enabled = False
            TI.Enabled = False
        ElseIf pria.Checked = True And duda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        Else
            TA.Text = 0
            JA.Text = 0
            TA.Enabled = False
            JA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        End If
        If pria.Checked = True Then
            wanita.Checked = False
        End If
        duda.Enabled = True
        janda.Enabled = False
        JA.Focus()
    End Sub

    Private Sub wanita_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles wanita.CheckedChanged
        If wanita.Checked = True And janda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        ElseIf wanita.Checked = True And nikah.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        Else
            TA.Text = 0
            JA.Text = 0
            TA.Enabled = False
            JA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        End If
        If wanita.Checked = True Then
            pria.Checked = False
        End If
        duda.Enabled = False
        janda.Enabled = True
        JA.Focus()
    End Sub

    Private Sub TA_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TA.TextChanged
       
        gaber.Text = Val(gapok.Text) + Val(TJ.Text) + Val(TI.Text) + Val(TA.Text)
    End Sub

    Private Sub gapok_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gapok.TextChanged
        gaber.Text = Val(gapok.Text) + Val(TJ.Text) + Val(TI.Text) + Val(TA.Text)
    End Sub

    Private Sub TI_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TI.TextChanged
        gaber.Text = Val(gapok.Text) + Val(TJ.Text) + Val(TI.Text) + Val(TA.Text)
    End Sub

    Private Sub TJ_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TJ.TextChanged
        gaber.Text = Val(gapok.Text) + Val(TJ.Text) + Val(TI.Text) + Val(TA.Text)
    End Sub

    Private Sub belum_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles belum.CheckedChanged
        If wanita.Checked = True And janda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        ElseIf wanita.Checked = True And nikah.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        ElseIf pria.Checked = True And nikah.Checked = True Then
            TI.Text = Val(gapok.Text) * 0.25
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        ElseIf pria.Checked = True And duda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        Else
            TA.Text = 0
            JA.Text = 0
            TA.Enabled = False
            JA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        End If
        JA.Focus()
    End Sub

    Private Sub nikah_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nikah.CheckedChanged
        If pria.Checked = True And nikah.Checked = True Then
            TI.Text = Val(gapok.Text) * 0.25
            JA.Enabled = True
            TA.Enabled = False
            TI.Enabled = False
        ElseIf pria.Checked = True And duda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        ElseIf wanita.Checked = True And janda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        ElseIf wanita.Checked = True And nikah.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        Else
            TA.Text = 0
            JA.Text = 0
            TA.Enabled = False
            JA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        End If
        JA.Focus()
    End Sub

    Private Sub duda_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles duda.CheckedChanged
        If pria.Checked = True And nikah.Checked = True Then
            TI.Text = Val(gapok.Text) * 0.25
            JA.Enabled = True
            TA.Enabled = False
            TI.Enabled = False
        ElseIf pria.Checked = True And duda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        Else
            TA.Text = 0
            JA.Text = 0
            TA.Enabled = False
            JA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        End If
        duda.Enabled = True
        janda.Enabled = False
        JA.Focus()
    End Sub

    Private Sub JA_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JA.TextChanged
        On Error Resume Next
        If JA.Text >= 2 Then
            TA.Text = Val(gapok.Text) * 0.3
        ElseIf JA.Text >= 1 Then
            TA.Text = Val(gapok.Text) * 0.15
        Else
            TA.Text = 0
        End If
    End Sub

    Private Sub janda_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles janda.CheckedChanged
        If wanita.Checked = True And janda.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        ElseIf wanita.Checked = True And nikah.Checked = True Then
            JA.Enabled = True
            TA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        Else
            TA.Text = 0
            JA.Text = 0
            TA.Enabled = False
            JA.Enabled = False
            TI.Text = 0
            TI.Enabled = False
        End If
        JA.Focus()
    End Sub
End Class

Komentar