Pada tulisan kali ini saya akan membahas cara membuat aplikasi sederhana tentang reservasi hotel menggunakan VB6

berikut langkah-langkahnya

1. siapkan sebuah project dengan cara klik file -> New Project

2. kemuadian tambahkan form seperti gambar berikut

3. ketikan coding program berikut

Dim fasilitas, internet, tv, sewa, total, bayar, kembali As Long

Private Sub Check1_Click()
If Check1.Value = 1 Then
internet = 200000
Else
internet = 0
End If
hitung
End Sub

Private Sub Check2_Click()
If Check2.Value = 1 Then
tv = 100000
Else
tv = 0
End If
hitung
End Sub

Private Sub Combo1_Change()
If Combo1.Text = “S001” Then
Text2.Text = “Single Bad”
ElseIf Combo1.Text = “D001” Then
Text2.Text = “Double Bad”
End If
End Sub

Private Sub Combo1_Click()
If Combo1.Text = “S001” Then
Text2.Text = “Single Bad”
ElseIf Combo1.Text = “D001” Then
Text2.Text = “Double Bad”
End If

End Sub

Private Sub Command1_Click()
Call bersihlayar
End Sub

Private Sub Command2_Click()
Dim pesan As String
pesan = MsgBox(“Yakin akan keluar dari aplikasi?”, vbYesNo, “KONFIRMASI”)
If vbYes Then
Unload Me
End If
End Sub

Private Sub Form_Load()
Combo1.AddItem “S001”
Combo1.AddItem “D001”

Call bersihlayar

End Sub

Private Sub Option1_Click()
If Combo1.Text = “S001” Then
sewa = 1000000
ElseIf Combo1.Text = “D001” Then
sewa = 1200000
Else
sewa = 0
End If
Text3.Text = Format(sewa, “currency”)
End Sub

Private Sub Option2_Click()
If Combo1.Text = “S001” Then
sewa = 900000
ElseIf Combo1.Text = “D001” Then
sewa = 1000000
Else
sewa = 0
End If
Text3.Text = Format(sewa, “currency”)
End Sub

Private Sub Option3_Click()
If Combo1.Text = “S001” Then
sewa = 800000
ElseIf Combo1.Text = “D001” Then
sewa = 900000
Else
sewa = 0
End If
Text3.Text = Format(sewa, “currency”)
End Sub
Sub hitung()
fasilitas = tv + internet
Text4.Text = Format(fasilitas, “currency”)
total = fasilitas + sewa
Text5.Text = Format(total, “currency”)
Text6.SetFocus
End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
bayar = Text6.Text
Text6.Text = Format(bayar, “currency”)
kembali = bayar – total
Text7.Text = Format(kembali, “currency”)
End If

End Sub

Public Sub bersihlayar()
Text1.Text = “”
Combo1.Text = “”
Text2.Text = “”
Option1.Value = False
Option2.Value = False
Option3.Value = False
Check1.Value = False
Check2.Value = False
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
Text7.Text = “”
End Sub

4. jika sukses maka akan tampil form seperti berikut

—–Selamat Mencoba—–