Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:59:54+00:00 2026-06-10T23:59:54+00:00

I want to know if any ErrorProvider are active in my form. being able

  • 0

I want to know if any ErrorProvider are active in my form.
being able to find this out might help reduce my code..

I did find this thing here Counting ErrorProvider

but incase someone knows a better way… so here goes.

Ok so basically I have a WinForm which has many TextBoxes
Now when user enters values I use Validating to perform validation and if it does not match Regex I set the ErrorProvider ON for that Control.. similarly if the user changes the value to a acceptable one I switch ErrorProvider OFF for that Control..

but when SAVE is clicked i have to do another check anyways incase the user did not listen to me and change the thing like he was supposed to and still clicked SAVE.. I dont want the thing crashing..

soo mm is there like a thing where I could say if ErrorProviders is not active then proceed with save else message box saying change it.

[ANOTHER QUESTION]

Umm When Validating it only Validates when the Control loses Focus… I kinda of want it to do validation when user stops typing.. I hope you get what I mean

Like Email Address(textbox) when user is typing his/her name in I [DON’T] want it to do validation yet, but when user has finished entering is waiting for ErrorProvider to disappear(But it doesn’t coz it only does that when control loses focus) 2 odd seconds after typing can i make the validation take place?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:59:56+00:00Added an answer on June 10, 2026 at 11:59 pm

    Unfortunately, the ErrorProvider control doesn’t provide such functionality. You’d best go with the custom error provider classes from the link you posted.

    Otherwise, you could create a method that you would call instead of SetError

    int errorCount;
    void SetError(Control c, string message)
    {
        if (message == "")
            errorCount--;
        else
            errorCount++;
        errorProvider.SetError(c, message);
    }
    

    Or you could make an extension method for the ErrorProvider class that would set the error and increment a counter or something along those lines.

    And last but not least, you could iterate through all the controls. Slow, but it works:

    bool IsValid()
    {
        foreach (Control c in errorProvider1.ContainerControl.Controls)
            if (errorProvider1.GetError(c) != "")
                return false;
        return true;
    }
    

    Edit

    I’ve written a quick extension class for the error provider:

    public static class ErrorProviderExtensions
    {
        private static int count;
    
        public static void SetErrorWithCount(this ErrorProvider ep, Control c, string message)
        {
            if (message == "")
            {
                if (ep.GetError(c) != "")
                    count--;
            }
            else
                count++;
    
            ep.SetError(c, message);
        }
    
        public static bool HasErrors(this ErrorProvider ep)
        {
            return count != 0;
        }
    
        public static int GetErrorCount(this ErrorProvider ep)
        {
            return count;
        }
    }
    

    I haven’t tested it extensively, so you might want to do a bit more validation before calling SetError on your ErrorProvider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know if exists any form to have the Android SDK into
I want to know is there any way that I can remove duplicates from
I want to know is there any way or message in MFC by which
I just want to know is there any tool works with silverlight3 for UI
Do you know any way for safe copy cut operation in Android? I want
Am working with knockout template binding, i just want to know is there any
I want to know if there is any kind of report on maven that
I want to know that is there any better method to do : var
I want to know if there's any way to update from all versions (Example:
I want to know if there is any overlap between polygon1.the_geom and polygon2.the_geom .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.