This piece of code gets the information from a customer and sorts it out to different classes (types of car - standard or wide). I was wondering how can I use this information and be able to to list it in a listBox located on a different Windows Form?
private void buttonSave_Click(object sender, EventArgs e)
{
if (radioWide.Checked)
{
Car newCar = new Wide(textCustomerName.Text, textCarLicense.Text, textCarMake.Text, textCarColour.Text);
currentCar = newCar;
}
else if (radioStandard.Checked)
{
Car newCar = new Standard(textCustomerName.Text, textCarLicense.Text, textCarMake.Text, textCarColour.Text);
currentCar = newCar;
}
"(textCustomerName.Text, textCarLicense.Text, textCarMake.Text, textCarColour.Text);" - these are text boxes that the user will type in, and radioWide and radioStandard are the radio buttons to give you a little visualization
My listbox right now is empty and has different columns to separate the information that I have received from the user this is what the code with the columns currently looks like
//Set up columns in ListView
public static void SetListColumns(ListView listCar)
{
listCar.Columns.Add("Customer Name");
listCar.Columns.Add("Car License Plate");
listCar.Columns.Add("Car Make");
listCar.Columns.Add("Car Colour");
listCar.Columns.Add("Parking Space");
}
//Set up columns in ListView
public static void SetListColumns(ListView listCar)
{
listCar.Columns.Add("Customer Name");
listCar.Columns.Add("Car License Plate");
listCar.Columns.Add("Car Make");
listCar.Columns.Add("Car Colour");
}
//Closing the window using the Close button
private void buttonClose_Click(object sender, EventArgs e)
{
this.Close();
}
//Method to refresh view of the window
private void RefreshView()
{
//Display decarled columns customer variables
ListAllEntries.SetListColumns(listWide);
ListAllEntries.SetListColumns(listStandard);
}
listStandard and listWide are both the names of the listView.
The only problem is that I'm not sure how to display the userInput and be able to print them in the listboxes