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.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% 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.
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
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