Form awal
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub tbinput_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles tbinput.Click
txtjumlah.Text = ""
txtcara.Text = ""
End Sub
Private Sub tbproses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles tbproses.Click
Dim
vnama As String
Dim
vharga As Integer
Dim
vtotal As Integer
Dim
vdis As Integer
Dim
vbayar As Integer
If
(txtkode.Text.ToUpper = "SPT") Then
vnama = "Sepatu"
vharga = 200000
ElseIf
(txtkode.Text.ToUpper = "SND") Then
vnama = "Sandal"
vharga = 100000
ElseIf
(txtkode.Text.ToUpper = "TOP") Then
vnama = "Topi"
vharga = 50000
ElseIf
(txtkode.Text.ToUpper = "TAS") Then
vnama = "Tas"
vharga = 20000
End If
Dim
vjml As Integer
If
txtjumlah.Text = "" Then
MsgBox("Jumlah
Masih Kosong ")
txtjumlah.Focus()
Exit Sub
Else
vjml = txtjumlah.Text
End If
vtotal = Val(vjml) * Val(vharga)
If
(txtcara.Text.ToUpper = "T") Then
If
vjml > 10 Then
vdis = 5 / 100 * vtotal
Else
vdis = 2 / 100 * vtotal
End
If
Else
If
vjml > 10 Then
vdis = 1 / 100 * vtotal
Else
vdis = 0 / 100 * vtotal
End
If
End If
vbayar = vtotal - Val(vdis)
MsgBox("Nama
Barang : " & vnama & vbNewLine & "Jumlah Barang : " & vjml &
vbNewLine & _
"Harga
Barang :" & vharga &
vbNewLine & "Total Harga :"
& _
vtotal & vbNewLine & " Diskon
:" & vdis & vbNewLine & "
Total Bayar : " &
vbayar)
End Sub
Private Sub btnexit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnexit.Click
Dim
tanya As String
tanya = MsgBox("
Apakah Anda Yakin ?", vbYesNo + vbInformation, " Keluar")
If
tanya = vbYes Then End
End Sub
SAAT DIJALANKAN
1.
Masukan kode barang, jumlah barang, dan cara
beli (T untuk Tunai dan K untuk Kredit)
2.
Tekan tombol PROSES, maka akan muncul massage
box yang menerangkan Nama Barang, Jumlah Barang, Harga Barang, Total Harga,
Diskon, dan Total Bayar
3.
Bila tekan tombol INPUT maka layar akan kosong
kembali
4.
Dan bila menekan tombol EXIT maka akan keluar
dari layar runing
Tidak ada komentar:
Posting Komentar