I need help with this airline seating program. All I need it to do for now is take the data from the second form (radio box), put it in the text box on the first form, and at the same time, have it update the listbox on that first form. Here is a screen of what the program looks like:

http://i21.photobucket.com/albums/b251/jfindon/program-1.jpg

And here is my code for the first form. I just can't get the listbox to update, I can get the textboxes filled with the data just fine.

Dim secondForm As New Form2

    Private Sub lstSeats_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstSeats.SelectedIndexChanged



        Dim row As String = CStr(lstSeats.SelectedItem)



        txtA.Text = row.Chars(0)
        txtB.Text = row.Chars(1)
        txtC.Text = row.Chars(2)
        txtD.Text = row.Chars(4)
        txtE.Text = row.Chars(5)
        txtF.Text = row.Chars(6)

        txtRow.Text = lstSeats.SelectedIndex + 1





    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With lstSeats.Items


            For rowNumber As Integer = 1 To 15
                .Add("... ...")

            Next rowNumber

        End With

        With lstStats.Items
            .Add("Seats filled:")
            .Add("Windows avail:")
            .Add("Regular meals:")
            .Add("LowCal meals:")
            .Add("Veget meal:")
        End With


    End Sub

    Private Sub txtA_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtA.Click

        Dim row As String = CStr(lstSeats.SelectedItem)

        secondForm.ShowDialog()

        txtA.Text = secondForm.status = row

        lstSeats.Items(lstSeats.SelectedIndex) = txtA.Text


    End Sub

    Private Sub txtB_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtB.Click
        secondForm.ShowDialog()

        txtB.Text = secondForm.status
    End Sub

    Private Sub txtC_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtC.Click
        secondForm.ShowDialog()
        txtC.Text = secondForm.status

    End Sub

    Private Sub txtD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtD.Click
        secondForm.ShowDialog()
        txtD.Text = secondForm.status
    End Sub

    Private Sub txtE_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtE.Click
        secondForm.ShowDialog()
        txtE.Text = secondForm.status
    End Sub

    Private Sub txtF_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtF.Click
        secondForm.ShowDialog()
        txtF.Text = secondForm.status

    End Sub

    Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
        lstStats.Visible = True
    End Sub

Add a Save button to Assign Seat disable the X Close Button

Private Sub savebutton_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles savebutton.Click
Form1.lstsSeats.Update
Unload Me
End Sub

That might work lol. give it a shot and let me know

Nope, that didn't work. I can get the data to the textbox but when I try to update the selected index or whatever, I get an error that says there's nothing to assign. I must be doing something wrong.

just look for different VB forums and post on them, thats what i do when im chasin a quick reply

This article has been dead for over six months. Start a new discussion instead.