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
Tidak ada komentar:
Posting Komentar