Cara membuat Aplikasi Hotel di Visual Basic 2008

Pada post ane kali ini yaitu tentang Aplikasi Hotel,Perlu diketahui Setiap kita membuat Aplikasi Rental sudah pasti Rancangan nya berbeda

Langkah – langkah pembuatan aplikasi HOTEL 
Masukkan objek yang diperlukan seperti Label,Texbox ,ComboBox ,DateTime dll , untuk membuat Aplikasi tersebut,cara nya masih sama seperti biasa.Dalam pembuatan aplikasi kali ini kita ada penambahan tool nya yaitu CheckBox dan RadioButton. 
Cara memasukan objek Checbox dan RadioButton sama seperti objek yang lain,untuk lebih jelas nya perhatikan gambar berikut :


 Setelah kita membuat Checkboxnya, Berinama di text di bagian properties tersebut, dan kemudian di bagian Name berinama untuk memudahkan mengisi rumusnya ,cara nya sama seperti pengisian di Objek yang laen.
Perhatikan Gambar di bawah ini :













 Memasukan Objek Radio Button sama caranya seperti Checbox Perhatikan Gambar di bawah ini :













Apa guna Checkbox Dan Radio Button ??
Setelah kita membuat Tool tersebut kita belum tahu apa guna Checkbox Dan Radio Button.
Checkbox digunakan untuk memilih lebih dari satu seperti pilihan extrabet,Fitness,Cofe Break.
RadioButton digunakan ketika kita di tuntut untuk memilih salah satu dari pilihan yang ada.
Setelah selesai membuat  Checkbox ,RadioButton,dibagian Texbox Total kita ingin membuat nya besar dan berwarna maka cara sebagai berikut :
Klik ditexbox pilih properties
Klik dibagian font pilih ukuran Font nya klik ok
Setelah itu kita ingin Texbox bewarna untuk membeda dengan Texbox lainya maka kita buat Back color dengan cara klik Properties pilih Back color
Perhatikan Gambar dibawah ini :
















Memberi angka di TextBox disisi kanan , karena di aplikasi sering kita lihat angka nya keluar dari sisi kanan.
Cara mudah nya draq dari texbox pertama ke textbox berikutnya, setelah itu isi diproperties text 0, setelah itu pilih textAlign perataan nya kanan (Right)
Perhatikan gambar dibawah ini :











Mengisi Syntax di Aplikasi Hotel 
















Ini syntax form pertama untuk pengisian variabelnya

Public Class Form1

        Dim i As Integer
        Dim vtarif As Double
        Dim vextrabed As Double
        Dim vfitnes As Double
        Dim vcbreak As Double
        Dim vlaundry As Double
        Dim vt_fasilitas As Double
        Dim vpajak As Double
        Dim vharibsr As Double
        Dim vweek As Double
        Dim vmember As Double
        Dim vtotal As Double
        Dim vbayar As Double
   Dim vkembalian As Double

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cbo_Tipekamar.Items.Clear()
        cbo_Tipekamar.Items.Add("VIP")
        cbo_Tipekamar.Items.Add("EKONOMI")
        cbo_Tipekamar.Items.Add("DELUXE")
        cbo_Tipekamar.Items.Add("FAMILY")
    End Sub
Syntax tipe kamar (Cbo_Tipekamar)

Private Sub cbo_Tipekamar_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbo_Tipekamar.SelectedIndexChanged
        cbo_NOkamr.Items.Clear()
Untuk add data ditype tanpa harus mengetik satu persatu.(i) integernya.
        If cbo_Tipekamar.Text = "VIP" Then
            '-----------------------------------
            For i = 101 To 106
                cbo_NOkamr.Items.Add(i)
            Next
            '------------------------------------
            vtarif = 2000000
        ElseIf cbo_Tipekamar.Text = "EKONOMI" Then
            vtarif = 500000
            For i = 211 To 216
                cbo_NOkamr.Items.Add(i)
            Next

        ElseIf cbo_Tipekamar.Text = "DELUXE" Then
            vtarif = 1000000
            For i = 321 To 326
                cbo_NOkamr.Items.Add(i)
            Next
        ElseIf cbo_Tipekamar.Text = "FAMILY" Then
            vtarif = 1500000
            For i = 327 To 332
                cbo_NOkamr.Items.Add(i)
            Next
        End If
        txt_tarif.Text = FormatNumber(vtarif, 0, TriState.True, TriState.True, TriState.True)
    End Sub

Mengisi syntax di checkbox

Syntax di Extrabet (Cb_Extrabet)
Private Sub cb_Extrabed_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_Extrabed.CheckedChanged
        If cb_Extrabed.Checked = True Then
            vextrabed = 200000
            vt_fasilitas = vt_fasilitas + vextrabed
        Else
            vt_fasilitas = vt_fasilitas - vextrabed
            vextrabed = 0
        End If
        txt_extrabed.Text = FormatNumber(vextrabed, 0, TriState.True, TriState.True, TriState.True)
        txt_total_fasilitas.Text = FormatNumber(vt_fasilitas, 0, TriState.True, TriState.True, TriState.True)
    End Sub
Syntax di Fitness (cb_Fitnes)
Private Sub cb_Fitnes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_Fitnes.CheckedChanged
        If cb_Fitnes.Checked = True Then
            vfitnes = 100000
            vt_fasilitas = vt_fasilitas + vfitnes
        Else
            vt_fasilitas = vt_fasilitas - vfitnes
            vfitnes = 0
        End If
        Txt_fitnes.Text = FormatNumber(vfitnes, 0, TriState.True, TriState.True, TriState.True)
        txt_total_fasilitas.Text = FormatNumber(vt_fasilitas, 0, TriState.True, TriState.True, TriState.True)
    End Sub
Syntax di CofeBreak (cb_Cofebreak)
Private Sub cb_Cofebreak_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_Cofebreak.CheckedChanged
        If cb_Cofebreak.Checked = True Then
            vcbreak = 120000
            vt_fasilitas = vt_fasilitas + vcbreak
        Else
            vt_fasilitas = vt_fasilitas - vcbreak
            vcbreak = 0
        End If
        Txt_cofebreak.Text = FormatNumber(vcbreak, 0, TriState.True, TriState.True, TriState.True)
        txt_total_fasilitas.Text = FormatNumber(vt_fasilitas, 0, TriState.True, TriState.True, TriState.True)
    End Sub

Syntax di Laundry (Cb_Laundry)

    Private Sub Cb_Laudry_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cb_Laudry.CheckedChanged
        If Cb_Laudry.Checked = True Then
            vlaundry = 200000
            vt_fasilitas = vt_fasilitas + vlaundry
        Else
            vt_fasilitas = vt_fasilitas - vlaundry
            vlaundry = 0
        End If
        Txt_Laundry.Text = FormatNumber(vlaundry, 0, TriState.True, TriState.True, TriState.True)
        txt_total_fasilitas.Text = FormatNumber(vt_fasilitas, 0, TriState.True, TriState.True, TriState.True)
    End Sub
Untuk memudah kan kita mengisi Syntax,jika misal rumus tersebut fungsi nya sama,kita menggunakan cara mudah tanpa harus mengetik ulang rumus tersebut,cara sebagai berikut :
Blok syntax nya sesudah itu copy paste di tempat yang sama fungsinya,sesudah itu tekan Ctrl H,
Maka akan otomatis keluar menu berikut seperti gambar dibawah ini :














Syntax penunggu panggilan he
Sub caritotal()
        vtotal = vtarif * Val(txt_lama.Text) + vt_fasilitas + vpajak - vharibsr - vweek - vmember
        txt_total.Text = FormatNumber(vtotal, 0, TriState.True, TriState.True, TriState.True)
    End Sub
Mengis syntax di Radio Button
Syntax di Haribesar (Rd_haribesar)
Private Sub Rd_haribesar_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rd_haribesar.CheckedChanged
        If Rd_haribesar.Checked = True Then
            vharibsr = 10 / 100 * vtarif
        Else
            vharibsr = 0
        End If

        Txt_haribsr.Text = FormatNumber(vharibsr, 0, TriState.True, TriState.True, TriState.True)
        Call caritotal()
    End Sub
Syntax di weekend (rd_week)
 Private Sub rd_week_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rd_week.CheckedChanged
        If rd_week.Checked = True Then
            vweek = 15 / 100 * vtarif
        Else
            vweek = 0
        End If
        Txt_week.Text = FormatNumber(vweek, 0, TriState.True, TriState.True, TriState.True)

        Call caritotal()
    End Sub

Syntax di member (Rd_member)
    Private Sub rd_member_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rd_member.CheckedChanged
        If rd_member.Checked = True Then
            vmember = 25 / 100 * vtarif
        Else
            vmember = 0
        End If
        Txt_member.Text = FormatNumber(vmember, 0, TriState.True, TriState.True, TriState.True)
        Call caritotal()
    End Sub

Pengisian syntax di texbox (txt_Lama)
Private Sub txt_lama_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_lama.TextChanged
        Call caritotal()
    End Sub

    Private Sub txt_pajak_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_pajak.TextChanged
        Call caritotal()
    End Sub

    Private Sub txt_bayar_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt_bayar.KeyDown
        If e.KeyCode <> Keys.Enter Then Exit Sub
        vbayar = txt_bayar.Text
        If vbayar >= vtotal Then

            vkembalian = vbayar - vtotal
            txt_kembalian.Text = FormatNumber(vkembalian, 0, TriState.True, TriState.True, TriState.True)
            txt_bayar.Text = FormatNumber(vbayar, 0, TriState.True, TriState.True, TriState.True)
        Else

            MessageBox.Show("Uang anda tidak mencukupi untuk melakukan transaksi ini", "Peringatan", MessageBoxButtons.OK)
            txt_bayar.Clear()
            txt_bayar.Focus()

        End If
    End Sub

Pengisian syntax di Tombol / Button(bt_hapus dan bt_keluar)

    Private Sub bt_hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_hapus.Click
        txt_tarif.Clear()
        txt_lama.Clear()
        txt_pajak.Clear()
        txt_total_fasilitas.Clear()
        txt_total.Clear()
        txt_kembalian.Clear()
        txt_extrabed.Clear()
        Txt_fitnes.Clear()
        Txt_cofebreak.Clear()
        Txt_Laundry.Clear()
        Txt_haribsr.Clear()
        Txt_member.Clear()
        Txt_week.Clear()
    End Sub

    Private Sub bt_keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_keluar.Click
        If MessageBox.Show("Apakah anda yakin ingin keluar dari form tersebut?", "konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then

        End If
        Me.Close()
    End Sub
End Class
Tampilan Aplikasi Hotel
























Download Project nya Klik disini
Share this article :

Post a Comment

 
Support : | |
© TEKNOLOGI INFORMASI