Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 118,589 VB.NET Programmers for FREE! Ask your question and get quick answers from experts. There are 818 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Airline Reservation

 
Reply to this topicStart new topic

Airline Reservation, Having issues with tableAdaptors....

whydream
post 30 Jul, 2008 - 04:43 PM
Post #1


New D.I.C Head

*
Joined: 30 Jul, 2008
Posts: 6


My Contributions


Hello, how's it going? Me...I am very frustrated. I have been working on this for a few hours and unfortunately I am at a stand still. I am making an airline reservation form and have "hit a brick wall" This code used database programming and unfortunately I am not able to get a list of passengers in my reservationsListBox.
I am also unable to choose a flight number - it defaults to flight number 250. Please bear with me, I am new to this but I would love to learn from anyone that is able to lend a hand.
I really appreciate you taking the time to read this.
Have a great Day!!
Darci



CODE
Public Class AirlineReservationForm

    ' Private Sub FlightsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '   Me.Validate()
    '   Me.FlightsBindingSource.EndEdit()
    '   Me.FlightsTableAdapter.Update(Me.ReservationsDataSet.Flights)

    ' End Sub


    '  Private Sub FlightsBindingNavigatorSaveItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FlightsBindingNavigatorSaveItem.Click
    '  Me.Validate()
    '  Me.FlightsBindingSource.EndEdit()
    '  Me.FlightsTableAdapter.Update(Me.ReservationsDataSet.Flights)

    ' End Sub

    Private Sub AirlineReservationForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'ReservationsDataSet.Reservations' table. You can move, or remove it, as needed.
        Me.ReservationsTableAdapter.Fill(Me.ReservationsDataSet.Reservations)
        'TODO: This line of code loads data into the 'ReservationsDataSet.Flights' table. You can move, or remove it, as needed.
        Me.FlightsTableAdapter.Fill(Me.ReservationsDataSet.Flights)

    End Sub

    Private Sub flightNumberComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles flightNumberComboBox.SelectedIndexChanged
        'display flight numbers in combo box...not sure of the following code
        'flightNumberComboBox.DataSource = flightNumber

        'If flightNumber <> flightNumber Then
        FlightsTableAdapter.Fill(ReservationsDataSet.Flights)  ', flightNumberComboBox.Text)
        ' Else
        ReservationsTableAdapter.Fill(ReservationsDataSet.Reservations)
        ' End If

        ' flightNumberComboBox.Text = " "

    End Sub

    Private Sub DepartureCityTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DepartureCityTextBox.TextChanged

    End Sub
End Class


Thank you very much.
User is offlineProfile CardPM

Go to the top of the page


PsychoCoder
post 30 Jul, 2008 - 05:02 PM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,914



Thanked 83 times

Dream Kudos: 8100

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI, Boo.Net

My Contributions


Moved to VB.NET smile.gif
User is online!Profile CardPM

Go to the top of the page

whydream
post 30 Jul, 2008 - 06:56 PM
Post #3


New D.I.C Head

*
Joined: 30 Jul, 2008
Posts: 6


My Contributions



Hi again,
All right after looking at some of the posts within this thread I wound up finding the answer to one of my questions.
I had the flightNumberComboBox.Tex <> flightNumberComboBox.Text all wrong (now that I have tweaked it a bit - it works now) tongue.gif biggrin.gif tongue.gif (Happy Dance!!)

The only problem that I am having now is the fact that my passenger list shows every name from my database and does not show the specific flight with the specific passengers. Anyone know what i could do to fix this????

CODE

    Private Sub flightNumberComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles flightNumberComboBox.SelectedIndexChanged
        'display flight numbers in combo box...not sure of the following code
        'flightNumberComboBox.DataSource = flightNumber

        If flightNumberComboBox.Text <> flightNumberComboBox.Text Then
            FlightsTableAdapter.Fill(ReservationsDataSet.Flights)  ', flightNumberComboBox.Text)
        Else
            ReservationsTableAdapter.Fill(ReservationsDataSet.Reservations)
        End If

        ' flightNumberComboBox.Text = " "

    End Sub


Thank you very much.
Darci
[/quote]
User is offlineProfile CardPM

Go to the top of the page

dangerkeepoff
post 1 Aug, 2008 - 01:48 AM
Post #4


New D.I.C Head

*
Joined: 2 Jul, 2008
Posts: 9



Thanked 1 times
My Contributions


Hey Darci,
What you need is this:
CODE

Me.FlightsTableAdapter.Fill(Me.ReservationsDataSet.Flights)


        Dim drFlights As DataRowCollection = Me.ReservationsDataSet.Flights.Rows
        Dim rFlight As DataRow
        If Not Me.FlightsBindingSource.List.Count <= 0 Then
            For Each rFlight In drFlights
                Dim stItemName As String = rFlight("you field name here")

                flightNumberComboBox.Items.Add(stItemName)

            Next
        End If



Hope this helps

Tc
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/11/08 07:41PM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month