In one of my buttons click event I call the following method that clears the textboxes:
private void ClearTextBoxes(Control control) { foreach (Control c in control.Controls) { if (c.GetType() == typeof(TextBox)) { ((TextBox)(c)).Text = string.Empty; } } }
I am receiving the error "System.Windows.Forms.TextBox is a type but used like a variable" on the following line:
ClearTextBoxes(TextBox);