How can I use a Foreach Statement to do something to my TextBoxes?
foreach (Control X in this.Controls) { Check if the controls is a TextBox, if it is de
private IEnumerable GetTextBoxes(Control control) { if (control is TextBox textBox) { yield return textBox; } if (control.HasChildren) { foreach (Control ctr in control.Controls) { foreach (var textbox in GetTextBoxes(ctr)) { yield return textbox; } } } }