0% found this document useful (0 votes)
26 views

Coding

This document contains code for two forms in a hotel reservation application. Form1 allows the user to select the date, time, shift and cashier. It passes these selections to Form2. Form2 displays the room type selected in Form1 and calculates the room rate and total payment based on number of nights selected. It returns the change owed back to the user.

Uploaded by

periskarasma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Coding

This document contains code for two forms in a hotel reservation application. Form1 allows the user to select the date, time, shift and cashier. It passes these selections to Form2. Form2 displays the room type selected in Form1 and calculates the room rate and total payment based on number of nights selected. It returns the change owed back to the user.

Uploaded by

periskarasma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

FORM 1

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


MyBase.Load
Me.lblNama.Text = "Hotel Transylvania"
Me.Label1.Text = "Hari"
Me.Label2.Text = "Jam"
Me.Label3.Text = "Shift"
Me.Label4.Text = "Cashier"
Me.Button1.Text = "Next"
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


Button1.Click
Me.Hide()
Form2.Show()
End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles DateTimePicker1.ValueChanged

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If Me.ComboBox1.SelectedItem = "1" Then
Me.TextBox4.Text = "08.00 - 12.00"
ElseIf Me.ComboBox1.SelectedItem = "2" Then
Me.TextBox4.Text = "13.00 - 17.00"
ElseIf Me.ComboBox1.SelectedItem = "3" Then
Me.TextBox4.Text = "19.00 - 23.00"
End If
End Sub

End Class

FORM 2
Public Class Form2

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


MyBase.Load
Me.Label1.Text = "Lama Menginap"
Me.Label2.Text = "Harga Sewa Perhari"
Me.Label3.Text = "Biaya Sewa Kamar"
Me.Label4.Text = "Jumlah Bayar"
Me.Label5.Text = "Kembali"
Me.Button1.Text = "New"
Me.Button2.Text = "Close"
Me.Label7.Text = "Cashier"
Me.Label8.Text = "Jenis Kamar"

If Form1.ComboBox2.SelectedItem = "Abdul" Then


Label6.Text = "Abdul"
End If
If Form1.ComboBox2.SelectedItem = "Hamid" Then
Label6.Text = "Hamid"
End If

If Form1.ComboBox2.SelectedItem = "Al-Islami" Then


Label6.Text = "Al-Islami"
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


Button1.Click
If MsgBox("Save?", vbQuestion + vbYesNo, "Save") = vbYes Then
Me.Hide()
Form1.Show()
Else : Me.Show()
End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


Button2.Click
Me.Close()

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If Me.ComboBox1.SelectedItem = "VIP" Then
Me.TextBox2.Text = "750000"
ElseIf Me.ComboBox1.SelectedItem = "Kelas I" Then
Me.TextBox2.Text = "500000"
ElseIf Me.ComboBox1.SelectedItem = "Kelas II" Then
Me.TextBox2.Text = "300000"
ElseIf Me.ComboBox1.SelectedItem = "Kelas III" Then
Me.TextBox2.Text = "150000"
End If
End Sub

Private Sub TextBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


TextBox4.Click
Dim a, b As Integer
Dim c As New Double
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
c = a * b
TextBox3.Text = c
End Sub

Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles TextBox4.TextChanged
If TextBox3.Text = Int(TextBox3.Text) Then
TextBox5.Text = TextBox4.Text - TextBox3.Text
End If
End Sub
End Class

You might also like