Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub calculateButton_Click(sender As Object, e As EventArgs) Handles calculateButton.Click
- Dim name As String
- Dim garden As String
- Dim kitchen As String
- Dim adults As Integer
- Dim children As Integer
- Const GTOUR As Double = 1
- Const KTOUR As Double = 2
- Dim subtotal As Integer
- If nameTextBox.Text = "" Or phoneTextBox.Text = "" _
- Or dateTextBox.Text = "" Or gardenTextBox.Text = "" _
- Or kitchenTextBox.Text = "" Or adultsTextBox.Text = "" _
- Or childrenTextBox.Text = "" Then
- MessageBox.Show("Must Complete Entire Form", "Incomplete Form")
- Exit Sub
- End If
- Try
- name = nameTextBox.Text
- garden = gardenTextBox.Text.ToUpper
- kitchen = kitchenTextBox.Text.ToUpper
- adults = Convert.ToInt32(adultsTextBox.Text)
- children = Convert.ToInt32(childrenTextBox.Text)
- Catch fe As FormatException
- MessageBox.Show("Formart Invalid", "Format Error")
- Catch ex As Exception
- MessageBox.Show("Unexpected Error", "Unexpected Error")
- Exit Sub
- End Try
- If garden <> "YES" And garden <> "NO" Then
- MessageBox.Show("PLease enter Yes or No", "Incorrect Value")
- End If
- If kitchen <> "YES" And kitchen <> "NO" Then
- MessageBox.Show("Please enter Yes or No", "Incorrect Value")
- End If
- If kitchen = "NO" And garden = "NO" Then
- MessageBox.Show("Must choose kitchen or garden tour", "Invalid")
- Exit Sub
- End If
- If adults < 0 Then
- MessageBox.Show("PLease enter valid number", "Invalid number")
- Exit Sub
- End If
- If children < 0 Or children > 10 Then
- MessageBox.Show("Value must be between 0 and 10", "Invalid number")
- Exit Sub
- End If
- If adults + children > 20 Then
- MessageBox.Show("No more than 20 people per reservation", "Maximum exceeded")
- Exit Sub
- End If
- If children > 3 * adults Then
- MessageBox.Show("Must be 1 adult per 3 children", "Unacceptable Ratio")
- Exit Sub
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement