Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox Friend WithEvents ListBox1 As System.Windows.Forms.ListBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Button4 As System.Windows.Forms.Button Private Sub InitializeComponent() Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.TextBox3 = New System.Windows.Forms.TextBox Me.TextBox2 = New System.Windows.Forms.TextBox Me.TextBox1 = New System.Windows.Forms.TextBox Me.Label3 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Label1 = New System.Windows.Forms.Label Me.GroupBox2 = New System.Windows.Forms.GroupBox Me.RadioButton3 = New System.Windows.Forms.RadioButton Me.RadioButton2 = New System.Windows.Forms.RadioButton Me.RadioButton1 = New System.Windows.Forms.RadioButton Me.GroupBox3 = New System.Windows.Forms.GroupBox Me.ComboBox2 = New System.Windows.Forms.ComboBox Me.ComboBox1 = New System.Windows.Forms.ComboBox Me.GroupBox4 = New System.Windows.Forms.GroupBox Me.ListBox1 = New System.Windows.Forms.ListBox Me.Button1 = New System.Windows.Forms.Button Me.Button2 = New System.Windows.Forms.Button Me.Button3 = New System.Windows.Forms.Button Me.Button4 = New System.Windows.Forms.Button Me.GroupBox1.SuspendLayout() Me.GroupBox2.SuspendLayout() Me.GroupBox3.SuspendLayout() Me.GroupBox4.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.TextBox3) Me.GroupBox1.Controls.Add(Me.TextBox2) Me.GroupBox1.Controls.Add(Me.TextBox1) Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.Label2) Me.GroupBox1.Controls.Add(Me.Label1) Me.GroupBox1.Controls.Add(Me.GroupBox2) Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox1.Location = New System.Drawing.Point(0, 8) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(352, 192) Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Customer Information" ' 'TextBox3 ' Me.TextBox3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox3.Location = New System.Drawing.Point(176, 96) Me.TextBox3.Name = "TextBox3" Me.TextBox3.Size = New System.Drawing.Size(168, 23) Me.TextBox3.TabIndex = 6 Me.TextBox3.Text = "" ' 'TextBox2 ' Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox2.Location = New System.Drawing.Point(176, 64) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(168, 23) Me.TextBox2.TabIndex = 5 Me.TextBox2.Text = "" ' 'TextBox1 ' Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox1.Location = New System.Drawing.Point(176, 32) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(168, 23) Me.TextBox1.TabIndex = 4 Me.TextBox1.Text = "" ' 'Label3 ' Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label3.Location = New System.Drawing.Point(24, 96) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(144, 23) Me.Label3.TabIndex = 3 Me.Label3.Text = "Customer Phone" ' 'Label2 ' Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(24, 64) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(144, 23) Me.Label2.TabIndex = 2 Me.Label2.Text = "Customer Address" ' 'Label1 ' Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(24, 32) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(144, 23) Me.Label1.TabIndex = 1 Me.Label1.Text = "Customer Name" ' 'GroupBox2 ' Me.GroupBox2.Controls.Add(Me.RadioButton3) Me.GroupBox2.Controls.Add(Me.RadioButton2) Me.GroupBox2.Controls.Add(Me.RadioButton1) Me.GroupBox2.Location = New System.Drawing.Point(8, 128) Me.GroupBox2.Name = "GroupBox2" Me.GroupBox2.Size = New System.Drawing.Size(336, 56) Me.GroupBox2.TabIndex = 0 Me.GroupBox2.TabStop = False Me.GroupBox2.Text = "Payment Options" ' 'RadioButton3 ' Me.RadioButton3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton3.Location = New System.Drawing.Point(224, 24) Me.RadioButton3.Name = "RadioButton3" Me.RadioButton3.TabIndex = 2 Me.RadioButton3.Text = "Payment Due" ' 'RadioButton2 ' Me.RadioButton2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton2.Location = New System.Drawing.Point(112, 24) Me.RadioButton2.Name = "RadioButton2" Me.RadioButton2.TabIndex = 1 Me.RadioButton2.Text = "Partial Payment" ' 'RadioButton1 ' Me.RadioButton1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton1.Location = New System.Drawing.Point(8, 24) Me.RadioButton1.Name = "RadioButton1" Me.RadioButton1.TabIndex = 0 Me.RadioButton1.Text = "Paid In Full" ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.ComboBox2) Me.GroupBox3.Controls.Add(Me.ComboBox1) Me.GroupBox3.Location = New System.Drawing.Point(0, 208) Me.GroupBox3.Name = "GroupBox3" Me.GroupBox3.Size = New System.Drawing.Size(352, 48) Me.GroupBox3.TabIndex = 1 Me.GroupBox3.TabStop = False Me.GroupBox3.Text = "Plane Seating " ' 'ComboBox2 ' Me.ComboBox2.Items.AddRange(New Object() {"Row 2", "Seat 1:*", "Seat 2:*", "Seat 3:*", "Seat 4:*", "Seat 5:*", "Seat 6:*"}) Me.ComboBox2.Location = New System.Drawing.Point(184, 16) Me.ComboBox2.Name = "ComboBox2" Me.ComboBox2.Size = New System.Drawing.Size(160, 21) Me.ComboBox2.TabIndex = 1 Me.ComboBox2.Text = "Row 2" ' 'ComboBox1 ' Me.ComboBox1.Items.AddRange(New Object() {"Row 1", "Seat 1:*", "Seat 2:*", "Seat 3:*", "Seat 4:*", "Seat 5:*", "Seat 6:*"}) Me.ComboBox1.Location = New System.Drawing.Point(8, 16) Me.ComboBox1.Name = "ComboBox1" Me.ComboBox1.Size = New System.Drawing.Size(160, 21) Me.ComboBox1.TabIndex = 0 Me.ComboBox1.Text = "Row 1" ' 'GroupBox4 ' Me.GroupBox4.Controls.Add(Me.ListBox1) Me.GroupBox4.Location = New System.Drawing.Point(0, 264) Me.GroupBox4.Name = "GroupBox4" Me.GroupBox4.Size = New System.Drawing.Size(192, 104) Me.GroupBox4.TabIndex = 2 Me.GroupBox4.TabStop = False Me.GroupBox4.Text = "Information Display" ' 'ListBox1 ' Me.ListBox1.Location = New System.Drawing.Point(8, 16) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(176, 82) Me.ListBox1.TabIndex = 0 ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(232, 264) Me.Button1.Name = "Button1" Me.Button1.TabIndex = 3 Me.Button1.Text = "Assign" ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(232, 288) Me.Button2.Name = "Button2" Me.Button2.TabIndex = 4 Me.Button2.Text = "Display" ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(232, 312) Me.Button3.Name = "Button3" Me.Button3.TabIndex = 5 Me.Button3.Text = "Clear" ' 'Button4 ' Me.Button4.Location = New System.Drawing.Point(232, 336) Me.Button4.Name = "Button4" Me.Button4.TabIndex = 6 Me.Button4.Text = "Quit" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(352, 381) Me.Controls.Add(Me.Button4) Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.GroupBox4) Me.Controls.Add(Me.GroupBox3) Me.Controls.Add(Me.GroupBox1) Me.Name = "Form1" Me.Text = "TWA Airline Company" Me.GroupBox1.ResumeLayout(False) Me.GroupBox2.ResumeLayout(False) Me.GroupBox3.ResumeLayout(False) Me.GroupBox4.ResumeLayout(False) Me.ResumeLayout(False) End Sub #End Region Structure passenger Public name As String Public address As String Public phone As String Public payment As String End Structure Public flight(11) As passenger Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim hold As Integer Dim payed As Integer Dim cont As Integer cont = 0 checker(payed, cont) If cont > 0 Then Exit Sub End If If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex > 0 Then hold = ComboBox2.SelectedIndex If ComboBox2.Text = "Seat " & (hold) & ":*" Then flight(hold + 5).name = TextBox1.Text flight(hold + 5).address = TextBox2.Text flight(hold + 5).phone = TextBox3.Text flight(hold + 5).payment = payed ComboBox2.Items.RemoveAt(hold) ComboBox2.Items.Insert(hold, "Seat " & hold & ": " & TextBox1.Text) ComboBox2.Text = "Row 2" Else MessageBox.Show("Seat is already Filled", "Invalid Selection") Exit Sub End If Else If ComboBox2.SelectedIndex = 0 And ComboBox1.SelectedIndex > 0 Then hold = ComboBox1.SelectedIndex If ComboBox1.Text = "Seat " & hold & ":*" Then flight(hold).name = TextBox1.Text flight(hold).address = TextBox2.Text flight(hold).phone = TextBox3.Text flight(hold).payment = payed ComboBox1.Items.RemoveAt(hold) ComboBox1.Items.Insert(hold, "Seat " & (hold) & ": " & TextBox1.Text) ComboBox1.Text = "Row 1" Else MessageBox.Show("Seat is already Filled", "Invalid Selection") Exit Sub End If Else MessageBox.Show("Please Select only One Seat", "Bad Information") Exit Sub End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim hold As Integer Dim payment2 As String If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex > 0 Then hold = ComboBox2.SelectedIndex + 5 ListBox1.Items.Clear() ListBox1.Items.Add("Name :" & flight(hold).name) ListBox1.Items.Add("Address :" & flight(hold).address) ListBox1.Items.Add("Phone :" & flight(hold).phone) pay_state(payment2, hold) ListBox1.Items.Add(payment2) ComboBox2.Text = "Row 2" Else If ComboBox2.SelectedIndex = 0 And ComboBox1.SelectedIndex > 0 Then hold = ComboBox1.SelectedIndex ListBox1.Items.Clear() ListBox1.Items.Add("Name :" & flight(hold).name) ListBox1.Items.Add("Address :" & flight(hold).address) ListBox1.Items.Add("Phone :" & flight(hold).phone) pay_state(payment2, hold) ListBox1.Items.Add(payment2) ComboBox1.Text = "Row 1" Else MessageBox.Show("Please select only one row", "Bad User Bad NO Biscuit") End If End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() ListBox1.Items.Clear() ComboBox1.Text = "Row 1" ComboBox2.Text = "Row 2" RadioButton1.Checked = False RadioButton2.Checked = False RadioButton3.Checked = False End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Close() End Sub Sub checker(ByRef payed As Integer, ByRef cont As Integer) Dim verify As String Try verify = CStr(TextBox1.Text) verify = CStr(TextBox2.Text) verify = CStr(TextBox3.Text) Catch ex As Exception MessageBox.Show("Please Enter Information", "Invalid Information") Exit Sub End Try If RadioButton1.Checked = True Then payed = 1 Else If RadioButton2.Checked = True Then payed = 2 Else If RadioButton3.Checked = True Then payed = 3 Else MessageBox.Show("Please select payment", "Information Missing") cont = 3 End If End If End If End Sub Sub pay_state(ByRef payment2 As String, ByVal hold As Integer) Select Case flight(hold).payment Case 1 payment2 = "Paid In Full" Case 2 payment2 = "Partial Payment" Case 3 payment2 = "Payment Due" End Select End Sub End Class