Minggu, 03 April 2011

VB Task 2









**FORM 1
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.Show()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form3.Show()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        End
    End Sub
End Class




**FORM 2
Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a As Integer
        For a = 1 To 31
            ComboBox2.Items.Add(a)
        Next
        Dim b As Integer
        For b = 1 To 12
            ComboBox3.Items.Add(MonthName(b))
        Next
        Dim c As Integer
        For c = 2010 To 1980 Step -1
            ComboBox4.Items.Add(c)
        Next
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
     

    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
       
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub
End Class




**FORM 3
Public Class Form3

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
       

    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Select ComboBox1.Text
            Case 1
                TextBox1.Text = "ELEX"
                Label2.Text = "17500"
            Case 2
                TextBox1.Text = "LEVEL"
                Label2.Text = "20000"
            Case 3
                TextBox1.Text = "M&C"
                Label2.Text = "16500"
            Case 4
                TextBox1.Text = "DC"
                Label2.Text = "25000"
        End Select
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        TextBox4.Text = TextBox3.Text * Label2.Text




    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ComboBox1.Text = ""
        TextBox1.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        Label2.Text = "Price / book"
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        TextBox5.Text = TextBox6.Text * Label6.Text

    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        Select Case ComboBox2.Text
            Case 1
                TextBox2.Text = "Animonster"
                Label6.Text = "30000"
            Case 2
                TextBox2.Text = "Wizard"
                Label6.Text = "25000"
            Case 3
                TextBox2.Text = "Cinemagz"
                Label6.Text = "35000"
        End Select
          
    End Sub

    Private Sub GroupBox4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox4.Enter

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        TextBox9.Text = (TextBox4.Text * 1 + TextBox5.Text * 1)



    End Sub

    Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
      
          

    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked Then
            TextBox8.Text = TextBox9.Text * 0.15
            TextBox7.Text = TextBox9.Text - TextBox8.Text
        Else
            TextBox8.Text = TextBox9.Text * 0
            TextBox7.Text = TextBox9.Text - TextBox8.Text
        End If
    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged

        If CheckBox2.Checked Then
            TextBox8.Text = TextBox9.Text * 0.1
            TextBox7.Text = TextBox9.Text - TextBox8.Text
        Else
            TextBox8.Text = TextBox9.Text * 0
            TextBox7.Text = TextBox9.Text - TextBox8.Text
        End If
    End Sub

    Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
        If CheckBox3.Checked Then
            TextBox8.Text = TextBox9.Text * 0.1
            TextBox7.Text = TextBox9.Text - TextBox8.Text
        Else
            TextBox8.Text = TextBox9.Text * 0
            TextBox7.Text = TextBox9.Text - TextBox8.Text

        End If

    End Sub

    Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged

    End Sub
End Class

Minggu, 06 Maret 2011

Tugas VB




Coding Form 1
Public Class Form1

    Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click

    End Sub

    Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click

    End Sub

    Private Sub Label15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label15.Click

    End Sub

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

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox5.Text = TextBox1.Text * 250000
        TextBox6.Text = TextBox2.Text * 250000
        TextBox7.Text = TextBox3.Text * 250000
        TextBox8.Text = TextBox4.Text * 250000

        TextBox9.Text = TextBox1.Text * 1 + TextBox2.Text * 1 + TextBox3.Text * 1 + TextBox4.Text * 1
        TextBox10.Text = TextBox5.Text * 1 + TextBox6.Text * 1 + TextBox7.Text * 1 + TextBox8.Text * 1

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox16.Text = TextBox11.Text * 450000
        TextBox17.Text = TextBox12.Text * 250000
        TextBox18.Text = TextBox13.Text * 250000
        TextBox19.Text = TextBox14.Text * 250000

        TextBox15.Text = TextBox11.Text * 1 + TextBox12.Text * 1 + TextBox13.Text * 1 + TextBox14.Text * 1
        TextBox20.Text = TextBox16.Text * 1 + TextBox17.Text * 1 + TextBox18.Text * 1 + TextBox19.Text * 1
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Form2.Show()
    End Sub
End Class

Coding Form 2
Public Class Form2

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

    End Sub

    Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox22.Text = TextBox21.Text * 1000000
        TextBox5.Text = TextBox1.Text * 700000
        TextBox6.Text = TextBox2.Text * 550000
        TextBox7.Text = TextBox3.Text * 475000
        TextBox8.Text = TextBox4.Text * 1250000

        TextBox9.Text = TextBox21.Text * 1 + TextBox1.Text * 1 + TextBox2.Text * 1 + TextBox3.Text * 1 + TextBox4.Text * 1
        TextBox10.Text = TextBox22.Text * 1 + TextBox5.Text * 1 + TextBox6.Text * 1 + TextBox7.Text * 1 + TextBox8.Text * 1
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox24.Text = TextBox23.Text * 1000000
        TextBox15.Text = TextBox11.Text * 700000
        TextBox16.Text = TextBox12.Text * 550000
        TextBox17.Text = TextBox13.Text * 475000
        TextBox18.Text = TextBox14.Text * 1250000

        TextBox19.Text = TextBox23.Text * 1 + TextBox11.Text * 1 + TextBox12.Text * 1 + TextBox13.Text * 1 + TextBox14.Text * 1
        TextBox20.Text = TextBox24.Text * 1 + TextBox15.Text * 1 + TextBox16.Text * 1 + TextBox17.Text * 1 + TextBox18.Text * 1


    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        End
    End Sub
End Class