Kamis, 19 April 2012

Tugas 2 Visual Basic

Tampilan Form Object Penginapan Hotel "BoBo Chiank" 

 

Tampilan Form code Penginapan Hotel “Bobo Chiank”

Sub aktif()
txtnama.Enabled = True
cmbkode.Enabled = True
txtjenis.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txthrg.Enabled = True
txtlama.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
txthrg.Enabled = False
txtlama.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
txthrg.Text = ""
txtlama.Text = ""
txttotal.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub

Private Sub cmbkode_Click()
If cmbkode.Text = "SU01" Then
txtjenis.Text = "Suite"
ElseIf cmbkode.Text = "BS01" Then
txtjenis.Text = "Bussines"
Else
txtjenis.Text = "President"
End If
End Sub
Private Sub cmdisi_Click()
aktif
bersih
End Sub

Private Sub cmdkeluar_Click()
X = MsgBox("Tutup From?", vbYesNo + vbQuestion, "Konfirmasi")
If X = vbYes Then
Unload Me
End If
End Sub

Private Sub Form_Activate()
aktif
cmbkode.AddItem "SU01"
cmbkode.AddItem "BS01"
cmbkode.AddItem "PR01"
txttgl.Text = Date
End Sub

Private Sub opt1_Click()
If opt1.Value = True Then
txtjenis.Text = "Suite"
txthrg.Text = 300000
ElseIf txtjenis.Text = "Bussines" Then
txthrg.Text = 500000
Else
txthrg.Text = 800000
End If
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
txtjenis.Text = "Suite"
txthrg.Text = 400000
ElseIf txtjenis.Text = "Bussines" Then
txthrg.Text = 600000
Else
txthrg.Text = 900000
End If
End Sub

Private Sub opt3_Click()
If opt1.Value = True Then
txtjenis.Text = "Suite"
txthrg.Text = 500000
ElseIf txtjenis.Text = "Bussines" Then
txthrg.Text = 700000
Else
txthrg.Text = 1000000
End If
End Sub

Private Sub txtlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text = Val(txthrg.Text) * Val(txtlama.Text)
End If
End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmbkode.SetFocus
End If
End Sub

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

Private Sub txtukem_KeyPress(KeyAscii As Integer)
If txtubay.Text < txttotal.Text Then
MsgBox "Uang Anda Kurang Rp." & Val(txttotal.Text) - Val(txtubay.Text) & "Input Uang Kembali", vbQuetion, "Warning"
End If
End Sub

Tampilan Form Run Penginapan Hotel “BoBo Chiank”


Tidak ada komentar:

Posting Komentar