I am calling three functions in my code where i want to validate some of my fields. When I tries to work with the code given below. It checks only for first value until it gets false result.
I want some thing like that if fisrt function returns true then it should also call next function and so on. What can be used instead of Or Operator to do this.
if (IsFieldEmpty(ref txtFactoryName, true, "Required") ||
IsFieldEmpty(ref txtShortName, true, "Required") ||
IsFieldEmpty(ref cboGodown, true, "Required"))
{ }
EDIT
public bool IsFieldEmpty(ref TextBox txtControl, Boolean SetErrorProvider,string msgToShowOnError)
{
ErrorProvider EP = new ErrorProvider();
if (txtControl.Text == string.Empty)
{
EP.SetError(txtControl, msgToShowOnError);
return true;
}
else
{
EP.Clear();
return false;
}
}
Please comment, Is this method fine using ref variable as one of the parameter.
I am checking for validation onSubmit event in winform
.