When using a foreach loop to change controls' attributes I often find that certain attributes are missing.
If I say btnMyButton. I can then select ".SelectedForeColor" from intellisense.
However, if I say foreach(Control x in this.Controls) or, foreach(Button x in this.Controls), the attribute ".SelectedForeColor" is missing from intellisense.
//This Works
btnMyButton.SelectedForeColor = Color.Blue;
This Does Not Work. The attribute is not available
foreach (Control x in this.Controls)
{
if (x is Button)
{
((Button)x).SelectedForeColor = Color.Blue;
}
}
Any thoughts on how to set Control.SelectedForeColor via a foreach loop would be appreciated.