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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:17:33+00:00 2026-05-31T21:17:33+00:00

I am dynamically assigning a form (think of it as a pseudo tab page)

  • 0

I am dynamically assigning a form (think of it as a “pseudo tab page”) to a tabcontrol.

I was doing it this way:

// Main form, which has the TabControl at design-time:

private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
    int TabControlWidth = tabPageBasicInfo.Size.Width;
    int TabControlHeight = tabPageBasicInfo.Size.Height;

    if (e.Node.Name == "NodeWhatever")
    {
        BasicInfoPseudoTab bipt = new BasicInfoPseudoTab(TabControlWidth, TabControlHeight);
        tabPageBasicInfo.Controls.Add(bipt);
        bipt.Show();
    }
    // else NodeThis, NodeThat
}

// Constructor on the form that is the “pseudo tab page”:

// overloaded constructor, passing in the dimensions of the tab page
public BasicInfoPseudoTab(int ATabPageWidth, int ATabPageHeight) 
{
    this.TopLevel = false;
    this.FormBorderStyle = FormBorderStyle.None;
    this.Width = ATabPageWidth;
    this.Height = ATabPageHeight;
    this.Visible = true;
}

…but then I experimented with setting the Dock property:

public BasicInfoPseudoTab(int ATabPageWidth, int ATabPageHeight) 
{
    this.TopLevel = false;
    this.FormBorderStyle = FormBorderStyle.None;
    //this.Width = ATabPageWidth;
    //this.Height = ATabPageHeight;
    this.Visible = true;
    this.Dock = DockStyle.Fill;         
}

…and it works great, so I thought I’d just use the “in the box” constructor by stripping out the two args. However, that’s not allowed, as get, “Type ‘UserControlsOnTabPagePOCApp.BasicInfoPseudoTab’ already defines a member called ‘BasicInfoPseudoTab’ with the same parameter types”

The Load() event is too late (when I was setting the TopLevel property there, it gave me an err msg until I moved it to the constructor).

What do I need to do to override (rather than overload) the constructor, or what other event should I use (does anything come before the Load() event?)

ALSO (I didn’t want to put the same code in two different questions): the form itself displays fine on the TabControl, but the controls I’ve added to the form/pseudo Tag page at design-time do not display at run-time – why?

  • 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-31T21:17:34+00:00Added an answer on May 31, 2026 at 9:17 pm

    It’s not a matter of overriding a constructor (constructors aren’t polymorphic like that anyway) – it’s a matter of the constructor already existing. I’d expect it to be present already in your code – something like this:

    public BasicInfoPseudoTab()
    {
        InitializeComponent();
    }
    

    You can edit that constructor, rather than declaring another parameterless one. Note that your other constructor should either chain to that one or call InitializeComponent() itself, so that all the designer code can do its stuff.

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

Sidebar

Related Questions

I am dynamically generating a function and assigning it to a class. This is
I'm looking for a way to dynamically load a master page in order to
The windows form that I designed has 1 label. The text of this label
friends, i am using asp.net calendar control on page. dynamically i am assigning it
I´m dynamically creating an instance of a class with reflection and this works fine,
I am dynamically adding an image to a canvas object which was working for
I am dynamically adding labels to a form and I would like to set
This code attempts to dynamically switch the class of the StateContainer div from StateOne
I got stuck up while dynamically assigning methods to a delegate instance through reflection.
I have found the following script for dynamically assigning hotkeys to already open windows:

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.