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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:12:07+00:00 2026-05-16T06:12:07+00:00

I have an application with plugin-like structure. all application forms inherit from a base

  • 0

I have an application with plugin-like structure.
all application forms inherit from a base UserControl :

public class BaseUserControl : UserControl
{
// some common properties and methods
//
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
}
}

and are compiled in different assemblies.

When I want to show a form, it goes through this sequence:

assembly = Assembly.LoadFile(assemblypath);
.
.
frm = (BaseUserControl)assembly.CreateInstance(frmname);
.
.
SomeContainer.Controls.Add(frm);
MainScreen.Controls.Add(SomeContainer);

Common structure of these forms is :

public class TestForm : BaseUserControl {
    public TestForm(){InitializeComponent();}
    private void InitializeComponent(){
.
.
    this.Load += new System.EventHandler(this.TestForm_Load);
. 
   }
   private void TestForm_Load(object sender, EventArgs e){}

}

The problem is that the Load event of these forms does not get fired.

Another behavior, I don’t understand how, when setting a break point at the OnLoad in the base class, the call stack shows that is called from within the InitializeComponent.

Any ideas on how to solve this?

  • 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-16T06:12:08+00:00Added an answer on May 16, 2026 at 6:12 am

    You are hopelessly mixing up the terms Form and UserControl, making it very hard to give a good answer. They are very different beasts, you can’t turn a UC into a form. It is a client window, not a top-level window. I suspect that has something to do with your problem but the generic diagnostic is that somebody is overriding OnLoad and not calling base.OnLoad().

    Yes, OnLoad may be called from code in InitializeComponent(). It isn’t very healthy since OnLoad will run before the constructor is finished, but it is supported. This will happen when you touch a property that requires the Handle to be created. The call stack should show you which particular property assignment did this, just double-click the line in the call stack.

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

Sidebar

Related Questions

I have a plugin that is loaded by this application.. This plugin calls some
I have a iframe application, in that app i put a fb like plugin.
I have an application that uses the Paperclip plugin for image upload. Now that
I am using the Google Application Engine plugin for Eclipse 3.4, and I have
I have this Grails application wherein I installed JQuery, JQuery-UI, and JQGrid plugin. I
I have a little facebook iframe application written with rails and the facebooker plugin.
I have inherited a Grails app, which uses the Acegi 0.5.3 plugin. The application
I have this table structure <table id=latest class=debt> <thead> <tr> <th width=50>Credor</th> <th width=50>Devedor</th>
I have a facebook app that load some content with ajax, including some like
I have a application which is loading PlugIn-Modules with reflection. The Application is defining

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.