Howto reach the controls in a tabcontrol, I want to color all the textboxen into a color with a simple foreach method:
foreach (Control c in this.Controls)
{
//btw I get the next error at this line: System.Windows.Forms.TabControl' is a 'type', which is not valid in the given context
if (c == System.Windows.Forms.TabControl)
{
c.BackColor = Color.FromArgb(240, 240, 240);
}
}
for (int i = 0; i < this.Controls.Count; i++)
{
if (this.Controls[i].GetType().ToString() == "System.Windows.Forms.Textbox")
{
this.Controls[i].BackColor = Color.FromArgb(240, 240, 240);
}
}
Could someone help my change one of the two codes