Senin, 04 April 2011

Tugas 2 Pemrograman Bisnis

Public Class Form1
// coding untuk tipe sepatu
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Select Case ComboBox1.Text
            Case "AR-62"
                TextBox1.Text = 500000
            Case "BIB"
                TextBox1.Text = 250000
            Case "SEpoRT"
                TextBox1.Text = 300000
            Case "Gagan 1"
                TextBox1.Text = 1500000
            Case "Gagan 2"
                TextBox1.Text = 1000000
            Case "Agan2"
                TextBox1.Text = 600000



        End Select
    End Sub
//coding untuk diskon
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            TextBox2.Text = TextBox1.Text * 0.15
        ElseIf CheckBox1.Checked = False Then
            TextBox2.Text = 0
        End If
    End Sub
// coding untuk jumlah diskon dan proses
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox3.Text = TextBox1.Text - TextBox2.Text
    End Sub
//coding untuk input data
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Clear()
        TextBox2.Clear()
        TextBox3.Clear()
        CheckBox1.Checked = False
        ComboBox1.Focus()


    End Sub
//coding untuk keluar
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim x As Integer
        x = MsgBox("Yakin Mau Keluar??", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Konfirmasi")
        If x = vbYes Then
            End
        End If
    End Sub
End Class






dan tampilan program adalah seperti berikut:

tampilan program setelah dijalankan:

Minggu, 06 Maret 2011

tugas vb

Membuat program untuk mencatat harga, jumlah, diskon, dan total harga barang.

Codingnya sebagai berikut

Form 2
_______________________________________________________________________________________________________________

Public Class Form2

    Private Sub tb4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb4.Click
        tb4.Text = tb2.Text * tb3.Text

    End Sub
_______________________________________________________________________________________________________________

    Private Sub checkBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged
        If checkBox1.Checked = True Then
            tb5.Text = tb4.Text * (10 / 100)
        ElseIf checkBox1.Checked = False Then
            tb5.Text = 0

        End If

    End Sub
_______________________________________________________________________________________________________________
   
    Private Sub tb6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb6.Click
        tb6.Text = tb4.Text - tb5.Text

    End Sub
_______________________________________________________________________________________________________________

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        tb1.Clear()
        tb2.Clear()
        tb3.Clear()
        tb4.Clear()
        tb5.Clear()
        tb6.Clear()

    End Sub
_______________________________________________________________________________________________________________

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

    End Sub
_______________________________________________________________________________________________________________

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

    End Sub

End Class
_______________________________________________________________________________________________________________

Jika checkbox1 di pilih maka harga barang akan  di diskon sebesar 10%, dan jika tidak dipilih, maka diskon akan menjadi 0


dan tampilan programnya adalah seperti berikut