The Sims 3 - New Real House

Pemrograman 4

Nama ComboBox 1 : KB
Nama ComboBox 2 : KS
Nama TextBox 1 : NB
Nama TextBox 2 : NS
Nama TextBox 3 : HS
Nama TextBox 4 : JB
Nama TextBox 5 : jumbay
Nama TextBox 6 : UYD
Nama TextBox 7 : SB
Nama TextBox 8 : JD
Nama TextBox 9 : TB
Nama RadioButton 1 : cash
Nama RadioButton 2 : kredit
Nama CheckBox 1 : ya
Nama CheckBox 2 : tdk




Public Class Form2

    Private Sub KB_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB.Click
        If KB.Text = "G001" Then
            NB.Text = "Gula"
        ElseIf KB.Text = "GG001" Then
            NB.Text = "Rokok"
        ElseIf KB.Text = "M001" Then
            NB.Text = "Mie Instant"
        Else
            NB.Text = ""
        End If
    End Sub

    Private Sub KB_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB.SelectedIndexChanged
        If KB.Text = "G001" Then
            NB.Text = "Gula"
        ElseIf KB.Text = "GG001" Then
            NB.Text = "Rokok"
        ElseIf KB.Text = "M001" Then
            NB.Text = "Mie Instant"
        Else
            NB.Text = ""
        End If
    End Sub

    Private Sub KS_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles KS.Click
        If KS.Text = "BH" Then
            NS.Text = "Buah"
        ElseIf KS.Text = "KG" Then
            NS.Text = "Kilogram"
        ElseIf KS.Text = "GR" Then
            NS.Text = "Gram"
        ElseIf KS.Text = "ONS" Then
            NS.Text = "Ons"
        ElseIf KS.Text = "LS" Then
            NS.Text = "Lusin"
        Else
            NS.Text = ""
        End If
    End Sub

    Private Sub KS_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KS.SelectedIndexChanged
        If KS.Text = "BH" Then
            NS.Text = "Buah"
        ElseIf KS.Text = "KG" Then
            NS.Text = "Kilogram"
        ElseIf KS.Text = "GR" Then
            NS.Text = "Gram"
        ElseIf KS.Text = "ONS" Then
            NS.Text = "Ons"
        ElseIf KS.Text = "LS" Then
            NS.Text = "Lusin"
        Else
            NS.Text = ""
        End If
    End Sub

    Private Sub NB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NB.TextChanged
        If NB.Text = "Gula" And NS.Text = "Kilogram" Then
            HS.Text = 7000
        ElseIf NB.Text = "Mie Instant" And NS.Text = "Buah" Then
            HS.Text = 2000
        ElseIf NB.Text = "Mie Instant" And NS.Text = "Lusin" Then
            HS.Text = 20000
        End If
    End Sub

    Private Sub NS_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NS.TextChanged
        If NB.Text = "Gula" And NS.Text = "Kilogram" Then
            HS.Text = 7000
        ElseIf NB.Text = "Mie Instant" And NS.Text = "Buah" Then
            HS.Text = 2000
        ElseIf NB.Text = "Mie Instant" And NS.Text = "Lusin" Then
            HS.Text = 20000
        End If
    End Sub

    Private Sub cash_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cash.CheckedChanged
        jumbay.Text = Val(JB.Text) * Val(HS.Text)
    End Sub

    Private Sub kredit_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kredit.CheckedChanged
        jumbay.Text = Val(JB.Text) * Val(HS.Text)
        ya.Enabled = False
        tdk.Enabled = False
        JD.Text = 0
        UYD.Text = 0
        SB.Text = 0
    End Sub

    Private Sub ya_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ya.CheckedChanged
        If NB.Text = "Gula" And NS.Text = "Kilogram" And JB.Text > 20 Then
            JD.Text = Val(jumbay.Text) * 0.2
        ElseIf NB.Text = "Gula" And NS.Text = "Kilogram" And JB.Text > 10 Then
            JD.Text = Val(jumbay.Text) * 0.1
        Else
            JD.Text = 0
        End If
        tdk.Checked = False
    End Sub

    Private Sub tdk_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tdk.CheckedChanged
        JD.Text = 0
        ya.Checked = False
    End Sub

    Private Sub jumbay_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumbay.TextChanged
        TB.Text = Val(jumbay.Text) - Val(JD.Text)
    End Sub

    Private Sub JD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JD.TextChanged
        TB.Text = Val(jumbay.Text) - Val(JD.Text)
    End Sub

    Private Sub TB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TB.TextChanged
        SB.Text = Val(UYD.Text) - Val(TB.Text)
    End Sub

    Private Sub UYD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UYD.TextChanged
        SB.Text = Val(UYD.Text) - Val(TB.Text)
    End Sub
End Class

Komentar