Ketentuan
mendeklarasikan (memperkenlakan)
variabel mdis dengan tipe data double
kemudian menhitung jumlah beli, jika jumlah beli (TextBox3)
di atas 20000 maka akan mendapatkan diskon 10%
sebaliknya tidak mendapatkan, kemudian untuk
menghitung bayar dari jumlah beli di kurang diskon.
Coding Program
Public Class Form1
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim mdis As Double
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
If TextBox3.Text > 20000 Then
mdis = TextBox3.Text * 0.01
Else
mdis = TextBox3.Text * 0
End If
TextBox4.Text = mdis
TextBox5.Text = TextBox3.Text - TextBox4.Text
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox3.Enabled = False
TextBox4.Enabled = False
TextBox5.Enabled = False
End Sub
End Class


Posting Komentar