Not only you need to include combo box types, but also the types derived from it, or, more likely, from
In all cases, you have to check up the instance of your type with operator
if myControl is StdCtrls.TCustomComboBox then
As the deletion is condition, you cannot work with index 0, so you will need to modify your cycle. Appropriate way it to traverse the list of controls in (important!) reverse order. Also, you may need to apply the recursive traversing of the controls.
Note that this is the operation based on dynamic cast
approach, where you have to examine the
of the object known by its compile-type type
. Not only this can be a bit costly for the performance, it is also considered as violation of general OOP principles. Nevertheless, there are cases when you need to do that.