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 800595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:18:46+00:00 2026-05-14T23:18:46+00:00

We use derived Form-Classes, with one base form class for our software. On the

  • 0

We use derived Form-Classes, with one base form class for our software.

On the derived forms we use DataBinding extensively to deal with our BusinessObjects, all implementing IDataErrorInfo, throwing custom error-messages on false inputs to the GUI with ErrorProviders.

I now search for a way to implement a function in the base-form-class to get all ErrorProvider-Components on a Form and set the IconAlignment for every Control on the Form to left (since right is a spacing-problem).

Any Hints welcome…

Code for Setting the IconAlignment:

private void SetErrorProviderIconAlignment(ErrorProvider errorProvider, Control control)
{
    errorProvider.SetIconAlignment(control, ErrorIconAlignment.MiddleLeft);

    foreach (Control subControl in control.Controls)
    {
        SetErrorProviderIcon(errorProvider, subControl);
    }
}
  • 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-05-14T23:18:46+00:00Added an answer on May 14, 2026 at 11:18 pm

    We used an inherited ErrorProvider component instead which forcefully set/returned the default for the IconAlignment extended property.

    E.g.

    [ToolboxBitmap(typeof(ErrorProvider))]
    [ProvideProperty("IconAlignment", typeof(Control))]
    public class MyErrorProvider : ErrorProvider
    {
        #region Base functionality overrides
    
        // We need to have a default that is explicitly different to 
        // what we actually want so that the designer generates calls
        // to our SetIconAlignment method so that we can then change
        // the base value. If the base class made the GetIconAlignment
        // method virtual we wouldn't have to waste our time.
        [DefaultValue(ErrorIconAlignment.MiddleRight)]
        public new ErrorIconAlignment GetIconAlignment(Control control)
        {
            return ErrorIconAlignment.MiddleLeft;
        }
    
        public new void SetIconAlignment(Control control, ErrorIconAlignment value)
        {
            base.SetIconAlignment(control, ErrorIconAlignment.MiddleLeft);
        }
    
        #endregion
    }
    

    Then you could easily do a search/replace for new ErrorProvider() and replace with new MyErrorProvider().

    I cannot recall exactly, but you may find that you may need to open the Form’s designer in order to get it to reserialize the value passed into SetIconAlignment in the form.designer.cs files…

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

Sidebar

Ask A Question

Stats

  • Questions 417k
  • Answers 417k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I am a little confused. You assign current_mc in your… May 15, 2026 at 9:48 am
  • Editorial Team
    Editorial Team added an answer If you haven't yet, check out this wiki article on… May 15, 2026 at 9:48 am
  • Editorial Team
    Editorial Team added an answer You should define a css-class f.e.: .searchmatch { color: red;… May 15, 2026 at 9:48 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.