Selasa, 11 Oktober 2011

Program Visual Basic Hotel

Posted by Unknown On Selasa, Oktober 11, 2011 | No comments

Sintaknya :

Private Sub Timer1_Timer()
waktu.Caption = Format(Time, "hh : mm : ss")
tanggal.Caption = Format(Date, "dddd / mmmm / yyyy")
If Label1.Enabled = True Then
Label1.Enabled = False
Else
Label1.Enabled = True
End If
End Sub

Private Sub cmdkeluar_Click()
x = MsgBox("Are You Sure To Quit?", vbQuestion + vbOKCancel, "Konfirmasi")
If x = vbOK Then
End
End If
End Sub

Sub nonaktif()
txtnama.Enabled = False
cmbkode.Enabled = False
txtjenis.Enabled = False
txtharga.Enabled = False
txtlama.Enabled = False
txtbayar.Enabled = False
txtdiskon.Enabled = False
txttobay.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
End Sub

Sub aktif()
txtnama.Enabled = True
cmbkode.Enabled = True
txtjenis.Enabled = True
txtharga.Enabled = True
txtlama.Enabled = True
txtbayar.Enabled = True
txtdiskon.Enabled = True
txttobay.Enabled = True
txtubay.Enabled = True
txtukem.Enabled = True
End Sub

Sub bersih()
txtnama.Text = " "
cmbkode.Text = " "
txtjenis.Text = " "
txtharga.Text = " "
txtlama.Text = " "
txtbayar.Text = " "
txtdiskon.Text = " "
txttobay.Text = " "
txtubay.Text = " "
txtukem.Text = " "
End Sub

Private Sub cmbkode_Click()
If cmbkode.Text = "001" Then
txtjenis.Text = "VIP"
txtharga.Text = 350000
ElseIf cmbkode.Text = "002" Then
txtjenis.Text = "Deluxe"
txtharga.Text = 250000
Else
txtjenis.Text = "Standart"
txtharga.Text = 150000
End If
txtlama.SetFocus
End Sub

Private Sub cmdbersih_Click()
aktif
bersih
txtnama.SetFocus
End Sub

Private Sub cmdhitung_Click()
txtbayar.Text = Val(txtharga) * Val(txtlama)
If txtbayar.Text >= 500000 Then
txtdiskon = Val(txtbayar) * 0.1
txttobay = Val(txtbayar) - Val(txtdiskon)
End If
txtubay.SetFocus
End Sub

Private Sub Form_Activate()
nonaktif
bersih
cmdbersih.SetFocus
End Sub

Private Sub Form_Load()
cmbkode.AddItem "001"
cmbkode.AddItem "002"
cmbkode.AddItem "003"
End Sub

Private Sub txtlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdhitung.SetFocus
End If
End Sub

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

0 komentar:

Posting Komentar

Blog Archive

Blogroll