private void txtREf_Validating(object sender, CancelEventArgs e) { if (FAQ.DrPOExist(txtREf.Text)) { e.Cancel = true; txtREf.Focus(); errorProvider1.SetError(txtREf, "PO No is Exist"); } else { e.Cancel = false; errorProvider1.SetError(txtREf, null); } }