Thanks Darren!
> if ( control is ICustomControl )
> {
[quoted text clipped - 12 lines]
>> Thanks!
>> Ron
> if ( control is ICustomControl )
> {
[quoted text clipped - 12 lines]
> > Thanks!
> > Ron
Alternately, he can do this:
foreach (Control ctrl in this.Controls)
{
// Need to test to see if ctrl inherits interface ICustomControl here
ICustomControl control = ctrl as ICustomControl;
if ( control != null ) {
// do something
}
}
Jon Skeet [C# MVP] - 11 Mar 2008 21:02 GMT
> Alternately, he can do this:
> foreach (Control ctrl in this.Controls)
[quoted text clipped - 5 lines]
> }
> }
Or with C# 3 and .NET 3.5:
foreach (ICustomControl ctrl in this.Controls.OfType<ICustomControl>())
{
...
}

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk