private void ChangeTextBox(Control.ControlCollection con) { foreach (Control c in con) { if (c is TextBox) (c as TextBox).ReadOnly = true; if (c.HasChildren) ChangeTextBox(c.Controls); } }
foreach (TextBox tb in this.Controls.OfType<TextBox>()) { tb.ReadOnly = true; }
{
foreach (Control c in con)
{
if (c is TextBox)
(c as TextBox).ReadOnly = true;
if (c.HasChildren)
ChangeTextBox(c.Controls);
}
}
{
tb.ReadOnly = true;
}