OK! Problem resolved. Not solved, you'll note, as I'm not sure why your code was misbehaving. However, if you make these changes it works as desired.
method. At the end you Update all existing pumps, rather than just setting the fuel for the new one. This will slow your app down considerably and I would therefore suggest the following changes.
private void btnAddPump_Click(object sender, EventArgs e)
PetrolPump pumpInstance = new PetrolPump(_pumpIndex);
pumpInstance.FuelList = NewFuelList();
If you still want to call
you can do it that way and ignore this suggestion (but see modified UpdatePumpsWithFuels() later).
private List<Fuel> NewFuelList()
List<Fuel> result = new List<Fuel>();
foreach (Fuel fuel in _fuelList)
FuelName = fuel.FuelName,
FuelCost = fuel.FuelCost
private void UpdatePumpsWithFuels()
foreach (Control _control in tlpPumpControlHolder.Controls)
PetrolPump _pump = _control as PetrolPump;
if (_pump != null)
_pump.FuelList = NewFuelList();
I have not yet worked out why the old code misbehaved but if I do, I will let you know. For now this works.