I have a class ("ClassB") that inherits from 'ClassA' which inherist
from UserControl.
I then put ClassB onto a form. Is it then possible to tracerse all the
controls on the form that inherit from ClassA.
I would expect the following code to work... bring up ClassB from the
collection.
For Each component as ClassA in Form1.Controls
'this should give any control that is based on ClassA
Next
However, I get the following exception:
"Specified cast is not valid"
Is this not possible? I could have several different classes, all
inheriting from ClassA. I dont know what these classes will be until
run-time so I need to traverse by base class.
TIA