Kalau Tadi kita mengetahui Bagaaimana Penggunaan KEYPRESS di Vb 2008
sekarang kita langsung ke contoh kasusnya ya !!!
Buat Design Seperti ini ...
Sekarang isi lah Listing Programnya sesuai dengan apa yang ada di bawah ini ya ,,
agak sedikit di ralat juga tidak apa apa...
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
JB.Items.Add("Novel")
JB.Items.Add("Motivasi")
JB.Items.Add("Sejarah")
JB.Items.Add("Tokoh")
End Sub
Private Sub JB_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JB.SelectedIndexChanged
If JB.Text = "Novel" Then
Harga.Text = 100000
DiscountH.Text = 0.2 * Harga.Text
ElseIf JB.Text = "Motivasi" Then
Harga.Text = 120000
DiscountH.Text = 0.05 * Harga.Text
ElseIf JB.Text = "Sejarah" Then
Harga.Text = 200000
DiscountH.Text = 0.5 * Harga.Text
ElseIf JB.Text = "Tokoh" Then
Harga.Text = 150000
DiscountH.Text = 0.15 * Harga.Text
End If
End Sub
Private Sub JBeli_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles JBeli.KeyPress
If Asc(e.KeyChar) = 13 Then
TH.Text = Val(Harga.Text * JBeli.Text) - Val(DiscountH.Text)
If TH.Text >= 2000000 Then
DiscountJ.Text = 0.1 * TH.Text
Else
DiscountJ.Text = 0
End If
TP.Text = Val(TH.Text - DiscountJ.Text)
End If
End Sub
Private Sub Proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Proses.Click
Kembalian.Text = UP.Text - TP.Text
End Sub
Private Sub Ulangi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ulangi.Click
JB.Text = ""
Harga.Text = ""
DiscountH.Text = ""
JB.Text = ""
TH.Text = ""
DiscountJ.Text = ""
TP.Text = ""
UP.Text = ""
Kembalian.Text = ""
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
Me.Close()
End Sub
End Class
Dan inilah Hasilnya ...
Mengingatkan : untuk Uang Pembayaran Di iNput ya...
Sunday, January 4, 2015
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment