If I enter the code below, I get an error. Basically, the foreach will break when it comes across a Control that isn't a label.
foreach (Label currControl in this.Controls()) {
...
}
I have to do something like this.
foreach (Control currControl in this.Controls()) {
if(typeof(Label).Equals(currControl.GetType())){
...
}
}
can anyone think of a better way of doing it without me needing to check the type? Can I somehow get foreach to skip the objects that aren't Labels?