I have a class that extends usercontrol called PaintControl. I dragged a few of these paintcontrols onto my form. When I wanted to run the same bit of code, I used
This worked fine, but when I dragged another control (a button) onto the form, I got an error in runtime telling me I couldn't cast this button into type Paintcontrol.
How can I achieve what I want here, which is to cycle through all the controls of type PaintControl in the collection Usercontrols, and not any others?
Thanks in advance,
Jon
One day I will find a signature worthy of this space. That day has not yet come.
Code:
foreach( PaintControl ctl in Usercontrols){
ctl.dosomething();
}
How can I achieve what I want here, which is to cycle through all the controls of type PaintControl in the collection Usercontrols, and not any others?
Thanks in advance,
Jon
One day I will find a signature worthy of this space. That day has not yet come.