Sabtu, 14 April 2012

TAMPILAN FORM, KETENTUAN SOAL, DAN LISTING TUGAS PRA UTS 3, VB

TAMPILAN FORM VB  BLACKFOREST




























KETENTUAN SOAL  Blackforest :
  1. Ketika Form dijalankan, semua objek dalam keadaan aktif. Textbox tanggal berisi tanggal hari ini, Dan kursor berada pada Textbox Nama Customer.
    2.   Pilih kode Blackforest, maka jenis Blackforest akan tampil, dengan ketentuan sebagai berikut:

KODE  BLACKFOREST
JENIS  BLACKFOREST
CKT01
Coklat
TRS01
Tiramisu
STRB01
Strawbery
COFF01
Coffe

    3.  Pilih Ukuran Blacforest, maka akan tampil harga sebagai berikut:

JENIS
UKURAN
HARGA
Coklat
Small
50000

Medium
70000

Large
100000
Tiramisu
Small
80000

Medium
125000

Large
150000
Strawbery
Small
45000

Medium
75000

Large
90000
Coffe
Small
30000

Medium
60000

Large
85000

     4.Jumlah beli dinput, lalu tekan enter,maka
        Total Harga= Harga Blackforest * Jumlah Beli
        Uang bayar di input lalu tekan enter, maka:
        Uang kembali = Uang bayar – Total harga
     5.Jika Uang Bayar kurang, maka tampil pesan sebagai berikut :
        OOO,,, Less Money Rp. 50000,Please Input Again
    6. Bila Form kita close, maka akan tampil pesan sebagai berikut :
        Going Out!!


Listing Tugas VB Pra UTS 3 (Blackforest)
Sub aktif()
txtnama.Enabled = True                                              
cmbkode.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txtjumbel.Enabled = True
txtubay.Enabled = True
End Sub

Sub nonaktif()
txtnama.Enabled = False
txttgl.Enabled = False
cmbkode.Enabled = False
txtjenis.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtharga.Enabled = False
txtjumbel.Enabled = False
txttotal.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
End Sub

Sub bersih()
txtnama.Text = ""
cmbkode.Text = ""
txtjenis.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
txtharga.Text = ""
txtjumbel.Text = ""
txttotal.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub

Private Sub cmbkode_Click()
If cmbkode.Text = "CKT01" Then
txtjenis.Text = "Coklat"
ElseIf cmbkode.Text = "TRS01" Then
txtjenis.Text = "Tiramisu"
ElseIf cmbkode.Text = "STRB01" Then
txtjenis.Text = "Strawbery"
Else
txtjenis.Text = "Coffe"
End If
End Sub

Private Sub cmdclose_Click()
X = MsgBox("Going Out?..", vbYesNo + vbQuestion, "Konfirmasi")
If X = vbYes Then
Unload Me
End If
End Sub

Private Sub cmdinput_Click()
bersih
aktif
cmbkode.Text = "-pilih-"
txtnama.SetFocus
End Sub

Private Sub Form_Activate()
bersih
nonaktif
txttgl.Text = Date
cmbkode.AddItem "CKT01"
cmbkode.AddItem "TRS01"
cmbkode.AddItem "STRB01"
cmbkode.AddItem "COFF01"
cmdinput.Enabled = True
cmdclose.Enabled = True
End Sub

Private Sub opt1_Click()
If opt1.Value = True Then
If txtjenis.Text = "Coklat" Then
txtharga.Text = 50000
ElseIf txtjenis.Text = "Tiramisu" Then
txtharga.Text = 80000
ElseIf txtjenis.Text = "Strawbery" Then
txtharga.Text = 45000
Else
txtharga.Text = 30000
End If
Else
txtjumbel.SetFocus
End If
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
If txtjenis.Text = "Coklat" Then
txtharga.Text = 70000
ElseIf txtjenis.Text = "Tiramisu" Then
txtharga.Text = 125000
ElseIf txtjenis.Text = "Strawbery" Then
txtharga.Text = 75000
Else
txtharga.Text = 60000
End If
Else
txtjumbel.SetFocus
End If
End Sub

Private Sub opt3_Click()
If opt3.Value = True Then
If txtjenis.Text = "Coklat" Then
txtharga.Text = 100000
ElseIf txtjenis.Text = "Tiramisu" Then
txtharga.Text = 150000
ElseIf txtjenis.Text = "Strawbery" Then
txtharga.Text = 90000
Else
txtharga.Text = 85000
End If
Else
txtjumbel.SetFocus
End If
End Sub

Private Sub txtjumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text = Val(txtharga.Text) * Val(txtjumbel.Text)
txtubay.SetFocus
End If
End Sub

Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
a = Val(txttotal.Text) - Val(txtubay.Text)
If txtubay.Text < txttotal.Text Then
MsgBox "OOO,,,Less Money Rp." & Val(txttotal.Text) - Val(txtubay.Text) & ",Please Input Again ", vbOKOnly, "Warning!!"
txtubay.Text = ""
txtubay.SetFocus
Else
txtukem.Text = Val(txtubay.Text) - Val(txttotal.Text)
End If
End If
End Sub




Tidak ada komentar:

Posting Komentar