By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,671 Members | 1,556 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,671 IT Pros & Developers. It's quick & easy.

Using one Method to reset ErrorProvider in all Controls ?

P: n/a
Hi NG,

the problem :

im working with the error provider (EP) to remind users of filling
required fields. in each control i ve a check method which check the
field inputs and set if needed the error provider. also in each
control one method to reset all error providers ... looks like this :

/// <summary>Clears all ErrorProvider</summary>
/// <param name="ctl">First Control (this)</param>
private void ClearErrors(Control cotl)
{
errorProvider.SetError(cotl, String.Empty);
if(cotl.Controls.Count > 0)
{
foreach(Control subCtl in cotl.Controls)
{
ClearErrors(subCtl);
}
}
}

Now it would be nice if i could do the Reset of all EP in one class
for all controls. as posted above it takes only the current control
.... now it would be good to know if this idea can be done :) or better
to forget. cause im started a few weeks with OOP and c# its not clear
how i could implement this so it works global way.

any comments,suggestions,ideas or code snippets welcome
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.