VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 300,483 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,778 people online right now. Registration is fast and FREE... Join Now!




another airline reservation project

 

another airline reservation project, I have code down, i just need a little help

kr0nkness

2 Jul, 2008 - 07:54 AM
Post #1

New D.I.C Head
*

Joined: 2 Jul, 2008
Posts: 3

Hey all, I am doing the regular airline reservation project for my class and am stuck . I have assigned the radio buttons but need help creating reports from this system and displaying my output. I need help with
1. A report containing passenger name and telephone number for each assigned seat
2. a passenger ticket that include airline name, date of booking, passenger name and seat number.
so far i have:
CODE

Public Class Form1
    Structure passenger
        Dim seatno As String
        Dim passname As String
        Dim passtel As String
        Dim bookdate As DateTime
    End Structure
    Dim passlist(67) As passenger
    Dim pcount As Integer
    Dim rowcount As Integer = 18
    Dim seatcount As Integer = 4

    Dim arow(17) As Integer
    Dim crow(17) As Integer
    Dim drow(17) As Integer
    Dim frow(17) As Integer






    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        crow(0) = 2
        crow(1) = 2
        drow(17) = 2
        frow(17) = 2
        showall()

    End Sub

    Sub showall()
        Dim fmtstr As String = "{0,-3}{1,3}{2,3}{3,3}{4,3}"
        lstseats.Items.Clear()
        lstseats.Items.Add(String.Format(fmtstr, "", "A", "C", "D", "F"))
        lstseats.Items.Add("")
        For i As Integer = 0 To rowcount - 1
            lstseats.Items.Add(String.Format(fmtstr, i + 1, arow(i), crow(i), drow(i), frow(i)))


        Next
    End Sub

    Private Sub rtbfirst_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtbfirst.CheckedChanged
        If rtbfirst.Checked = True Then
            cborow.items.add(1)
            cborow.items.add(2)
        End If
    End Sub

    Private Sub rtbecon_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtbecon.CheckedChanged
        If rtbecon.Checked = True Then
            cborow.items.clear()
            For i As Integer = 3 To 18
                cborow.Items.Add(i)
            Next

        End If
    End Sub

    Private Sub btnbookflight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbook.Click
        
        If arow(cborow) <> 0 Then
            MsgBox("Seat is not available.  Please select another")
        Else
                                  'this is where my input is for each reservation

        End If

        showall()
    End Sub

    Private Sub rtbaisle_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtbaisle.CheckedChanged


        If rtbaisle.Checked = True Then
            cboseat.Items.Clear()

            cboseat.Items.Add("C")
            cboseat.Items.Add("D")
        End If
    End Sub

    Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancel.Click




    End Sub

    Private Sub rtbwindow_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtbwindow.CheckedChanged
        If rtbwindow.Checked = True Then
            cboseat.Items.Clear()
            cboseat.Items.Add("A")
            cboseat.Items.Add("F")


        End If

    End Sub
End Class


This post has been edited by kr0nkness: 2 Jul, 2008 - 09:41 AM

User is offlineProfile CardPM
+Quote Post


kr0nkness

RE: Another Airline Reservation Project

2 Jul, 2008 - 09:39 AM
Post #2

New D.I.C Head
*

Joined: 2 Jul, 2008
Posts: 3

actually let me rephrase that. I now only need to know how to make a cancel button clear my last input. also, how do you set an exit btn to close the program?
lastly, i am supposed to have each person who reserves a seat listed in a file called customerinfo.text. Is there someway for each time a new input is put in , make it listed in customerinfo.text?
>> i know of sw.writeline, but am confused on how to make it do that for each customer.
User is offlineProfile CardPM
+Quote Post

Damage

RE: Another Airline Reservation Project

2 Jul, 2008 - 05:36 PM
Post #3

D.I.C Addict
Group Icon

Joined: 5 Jun, 2008
Posts: 975



Thanked: 14 times
Dream Kudos: 75
My Contributions
well for the exit button

CODE


    Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
        Me.Close()
    End Sub


as for writing each new passenger to a text file, i'm not sure what info you want exactly written but you could use something like

import system.io
CODE

Dim objStreamWriter As StreamWriter
    
   'Pass the file path and the file name to the StreamWriter constructor.
   objStreamWriter = New StreamWriter("C:\customerinfo.txt")

   'Write a line of text.
   objStreamWriter.WriteLine("passenger 1")

   'Write a second line of text.
   objStreamWriter.WriteLine("seat details or whatever")

   'Close the file.
   objStreamWriter.Close()


and add it at the end of btnbookflight. i think something like that should work
User is offlineProfile CardPM
+Quote Post

Jayman

RE: Another Airline Reservation Project

2 Jul, 2008 - 05:36 PM
Post #4

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 8,544



Thanked: 226 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Clear your last input from what object?

To exit your application, in the click event of the Exit button use the following.
CODE

Me.Close()


You are correct that you will use a StreamWriter object to write to the text file. When you open the file, set the mode to Append and then use the WriteLine statement to write to the text file. Each time you add a customer open the text file and write the information to it. You can find an example and information here.
User is offlineProfile CardPM
+Quote Post

kr0nkness

RE: Another Airline Reservation Project

2 Jul, 2008 - 07:31 PM
Post #5

New D.I.C Head
*

Joined: 2 Jul, 2008
Posts: 3

thanks for the input. sounds good.
CODE
me.close()
was exactly what I was looking for.
The only problem I have left is when someone enters their name/phone number and clicks btnbook(which displays the seat they selected on my lstoutput, adds their name to customerinfo.text, and makes that seat unavailable.) I need to have my btncancel cancel the last booking entered, both from the lstoutput, and the customerinfo.text.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:05AM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month