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

  • SEARCH
  • Home
  • 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 8231293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:26:17+00:00 2026-06-07T17:26:17+00:00

If you have a Form that displays data, one thing you can do is

  • 0

If you have a Form that displays data, one thing you can do is reference this.DesignMode in the constructor to avoid populating it in the designer:

public partial class SetupForm : Form
{
    private SetupItemContainer container = new SetupItemContainer();

    public SetupForm()
    {
        InitializeComponent();
        if (!this.DesignMode)
        {
            this.bindingSource1.DataSource = this.container;
            this.Fill();
        }
    }
 }

However, if you decide to re-write that form as a UserControl, keeping the same constructor logic, something unexpected happens – this.DesignMode is always false no matter what. This leads to the designer invoking your logic that’s meant to happen at runtime.

I just found a comment on a blog post that seem to give a fix to this but it references functionality of the LicenseManager class as a replacement that works as expected in a UserControl.

So for a UserControl I can do:

public partial class AffiliateSetup : UserControl
{
    private AffiliateItemContainer container = new AffiliateItemContainer();

    public AffiliateSetup()
    {
        InitializeComponent();
        if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
        {
            this.bindingSource1.DataSource = this.container;
            this.Fill();
        }
    }
}

Does using the LicenseManager instead of DesignMode have any caveats or implications that might dissuade me from putting in my production code?

  • 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-07T17:26:19+00:00Added an answer on June 7, 2026 at 5:26 pm

    According to someone who posted a comment on my answer to another question, using LicenseManager doesn’t work in an OnPaint method.

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

Sidebar

Related Questions

I have an application that consists of two forms. One form displays data returned
I have a Form in my application that displays some data. When I first
So I have a form that can get data from a database by its
I have a form that can be manipulated on the client's browser via javascript
I have a view that displays a table: rows represent days - one row
I have to do this thing for work that's really just a formality. Normally
The short version of this question is: How can I take data that only
I have a web form. There are many different sections. I can say that
I currently have form that checks if a user has unsubmitted changes when they
I have a form that I'm submitting through AJAX. The form includes many fields,

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.