Jumat, 13 April 2012

Tugas Individu



Sub aktif()
txtnama.Enabled = True
cmbkue.Enabled = True
Check1.Enabled = True
Check2.Enabled = True
txtjml1.Enabled = True
txtjml2.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txtubay.Enabled = True
End Sub

Sub nonaktif()
txtnama.Enabled = False
cmbkue.Enabled = False
Check1.Enabled = False
Check2.Enabled = False
txtjml1.Enabled = False
txtjml2.Enabled = False
txtitem.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtkasir.Enabled = False
txttobay.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
txttgl.Enabled = False
txtwkt.Enabled = False
End Sub

Sub bersih()
txtnama.Text = ""
cmbkue.Text = ""
Check1.Value = 0
Check2.Value = 0
txtjml1.Text = ""
txtjml2.Text = ""
txtitem.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
txtkasir.Text = ""
txttobay.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub

Private Sub Check1_Click()
If Check1.Value = 1 Then
txthrg1.Text = 40000
Else: txthrg1.Text = 0
End If
txtitem.Text = Val(txtjml1.Text) + Val(txtjml2.Text)
End Sub

Private Sub Check2_Click()
If Check2.Value = 1 Then
txthrg2.Text = 50000
Else: txthrg2.Text = 0
End If
txtitem.Text = Val(txtjml1.Text) + Val(txtjml2.Text)
End Sub

Private Sub cmdhitung_Click()
txttobay.Text = Val(txthrg1.Text) +val(txthrg2.Text)* (txtitem.Text)
txtubay.SetFocus
cmdinput.Enabled = True
cmdhitung.Enabled = False
cmdkeluar.Enabled = True
End Sub

Private Sub cmdinput_Click()
bersih
aktif
txtnama.SetFocus
cmbkue.Text = "-pilih-"
cmdinput.Enabled = False
cmdhitung.Enabled = True
cmdkeluar.Enabled = True
End Sub

Private Sub cmdkeluar_Click()
x = MsgBox("tutup form ?", vbYesNo + vbQuestion, "konfirmasi")
If x = vbYes Then
Unload Me
End If
End Sub

Private Sub Form_Activate()
bersih
nonaktif
cmbkue.AddItem "Banana chesecake"
cmbkue.AddItem "Avocado Stowbery"
cmbkue.AddItem "Keju lapis mini"
cmbkue.AddItem "Chocolate wwaffle"
txttgl.Text = Date
txtwkt.Text = Time
cmdinput.Enabled = True
cmdhitung.Enabled = False
cmdkeluar.Enabled = True
End Sub

Private Sub opt1_Click()
If opt1.Value = True Then
txtkasir.Text = "Mega"
End If
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
txtkasir.Text = "Fitriyanti"
End If
End Sub

Private Sub opt3_Click()
If opt3.Value = True Then
txtkasir.Text = "Dini"
End If
End Sub

Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtukem.Text = Val(txtubay.Text) - Val(txttobay.Text)
End If
End Sub

0 komentar:

Posting Komentar