I have a class Car with 100's of parameters.
I add a bunch of Car instances to a listbox. They are now plain old objects.
Then when I selected an item from the listbox, I would like to cast the object back to Car and print the parameters on screen.
so I have 2 options:
option 1:
Expand|Select|Wrap|Line Numbers
- Textbox1.Text = ((Car) Listbox1.SelectedItem).param1.ToString();
- Textbox2.Text = ((Car) Listbox1.SelectedItem).param2.ToString();
- ...
- Textbox100.Text = ((Car) Listbox1.SelectedItem).param100.ToString();
Expand|Select|Wrap|Line Numbers
- Car c = new Car();
- c = (Car) Listbox1.SelectedItem;
- Textbox1.Text = c.param1.ToString();
- Textbox2.Text = c.param2.ToString();
- ...
- Textbox100.Text = c.param100.ToString();
thanks a lot!
Matt