Hi
I need help with the highlighted part at the very bottom.
The highlighted part is the code for the "View Information Button"
The problem is, when I choose bus 500 from combo box, the code works fine and shows last four names of passenger array. That's how it is supposed to be.
but then when I choose bus 400, it shows last 8 names plus last four names again, while it is supposed to show only 4 names of second last element of array.
just like when I choose bus 100, it shows all the names of passenger array, while it is supposed to show only first 4 names of the passenger array.
Here is what I have:
Public Class BusReservationFormDim destination As String(,) = {{"12/23/2013", "Atlanta", "Houston"},{"12/11/2013", "San Francisco", "New York"},{"12/24/2013", "Seattle", "Miami"},{"1/12/2014", "Las Vegas", "Chicago"},{"2/9/2014", "Boston", "Miami"}}Dim bus As Integer = 0Dim passenger As String(,) = {{"Tim Pedan", "Frank Maxwall","Roger Gange", "Kevin Conrad"},{"Filomina Sylva", "Moe Hernandez","Jon Flowers", "John Hathaway"},{"Brian Alban", "Chris Blaha","Simon Hoyle", "Carol Coggins"},{"Bill Raynolds", "Ronny Jenkins","Sheena Jenkins", "Ayu Johnson"},{"Darryl Jackson", "Sean Byfield","Caroline Litchfield", "Leigh Oats"}}Dim list As Integer = 0Private Sub BusReservationForm_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.LoadbusChoiceComboBox.Items.Insert(0, "100")busChoiceComboBox.SelectedItem = "100"busChoiceComboBox.Items.Add("200")busChoiceComboBox.Items.Add("300")busChoiceComboBox.Items.Add("400")busChoiceComboBox.Items.Add("500")End Sub ' BusReservationForm_LoadPrivate Sub busChoiceComboBox_SelectedIndexChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles busChoiceComboBox.SelectedIndexChangedSelect Case busChoiceComboBox.SelectedIndexCase 0bus = 0Case 1bus = 1Case 2bus = 2Case 3bus = 3Case 4bus = 4End Select' display infodateOutputLabel.Text = destination(bus, 0)departOutputLabel.Text = destination(bus, 1)arrivalOutputLabel.Text = destination(bus, 2)End SubPrivate Sub busInfoButton_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles busInfoButton.ClickFor row As Integer = 0 To passenger.GetUpperBound(0)For column As Integer = 0 To passenger.GetUpperBound(1)displayListBox.Items.Add(passenger(row, column))Next columnNext rowEnd SubEnd Class
displayListBox.Items.Clear() i kept and tried ..... still issue exists .. can u please edit my code so works fine
My best regards
Sunil G