see something like this
bool emptyFound = false;
foreach (Control c in this.Controls)
{
if (c.GetType() == typeof(TextBox))
{
if ((c as TextBox).Text == "")
{
emptyFound = true;
error.SetError(c, "Valid input required");
}
else
{
error.SetError(c, "");
}
}
}
return emptyFound;