I've been struggling for a while to find a way of calling an instance of a class from a user defined input.
Essentially I want to call an instance from my StandardVehicle class that has already been defined, however the problem is that the name of the instance that I'm calling is defined by a users selection on a combo box on a form.
This is how I assumed it would be formatted, however I get an error when I try calling the instance saying that I cannot complicitly convert from string to StandardVehicle.
StandardVehicle VauxhallB = new StandardVehicle();
VauxhallB.Model = "B";
VauxhallB.Manufacturer = "Vauxhall";
VauxhallB.Doors = 5;
VauxhallB.HorsePower = 200;
VauxhallB.Transmission = "Manual";
VauxhallB.Year = 2009;
VauxhallB.Cylinders = 6;
VauxhallB.Seats = 7;
VauxhallB.Price = 17000;
VauxhallB.Registration = "abc1243";
StandardVehicle objname = comboBox1.Text;
I'm assuming it's just a case of formatting the string, but I've been searching for hours and can't figure out what format it needs to be in to define it as an instance.
Any help would be appreciated.
Regards, S.
StandardVehicle
instances you bind to the combobox?