0

I am new to C# and stuck on this:

I have an array in my Dealership class that accepts user input for make, model, and year.

class Dealership
    {
        public static Car[] car = new Car[500];
        public static int carIndex = 0;
    }
public partial class FormAddCar : Form
{
 Dealership.car[Dealership.carIndex] = new Car(textBoxMake.Text, textBoxModel.Text, Convert.ToInt16(textBoxYear.Text), Convert.ToInt32(textBoxMileage.Text));
            Dealership.carIndex++;
}

I want a combo box to display these individually (make, model, year) and have looked up many examples with no success.
This is what I have so far...

public partial class FormSearchInventory : Form
{
private void comboBoxMake_SelectedIndexChanged(object sender, EventArgs e)
{
comboBoxMake.Items.AddRange(xxxxx);
}
}

HELP!

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by PennyPeso
0

Nevermind.. Solved.

for (int i = 0; i < Dealership.carIndex; i++)
                comboBox1.Items.Add(Dealership.car[i].Make);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.