Hello:
I need to pass/update/set an ErrorProvider. Here is my case:
I have a MDIParent that calls a MDIChild. The MDIChild has Controls for the Enter and Leave Events for all TextBoxs. The Leave Event in the Control calls a Class that will do the validation. In the ClassValidation I can use the
((TextBox)sender).Focus(); to set the focus to the invalid TextBox (It works fine).
Is there a way I can set the ErrorProvider in sort of the same way?
Something like this: ???
_______.errorProviderICEPack.SetError(((TextBox)sender), TheError);
Where the _______ is the name of the Form that the control was called from.
How can I: Create a dynamic ErrorProvider?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jaish MathewsRank #225 · 11K reputationPosted May 6, 2010, 6:21 AM EDT
Hi,
What about below by passing error provider?
public void MyValidation(Control ctrl, ErrorProvider errorProvider)
{
errorProvider.SetError(ctrl, "Wrong");
}
and calling like below
cls.Test(textBox1, this.errorProvider1);
GustavoRank #1,990 · 732 reputationPosted May 6, 2010, 7:07 AM EDT
Interesting... Not sure where to put or pass the code, but I will play with it. Will get back to you if I have questions or if I get it to wrok. Thanks.