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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:58:03+00:00 2026-05-21T21:58:03+00:00

I googled this and still cant get it to work. I know how to

  • 0

I googled this and still cant get it to work. I know how to add a tab using the toolbox. I have also read about how to do it programmatically, but i still dont get it. (MSVC# Express 2010)

I have an easy project set up. Just a windows Form with a TabControl in it, i used the Designer to add a new TabControl and made that TabControl public instead of private.

I wrote this code to
a) access the Windows Form
b) add a tabpage.

The code compiles just fine, but the Tabpage is not displayed during runtime.

static class Program
{
    [STAThread]
    static void Main()
    {
        Application.SetCompatibleTextRenderingDefault(false);
        Application.EnableVisualStyles();
        Form1 ApplicationMainForm = new Form1();
        Application.Run(ApplicationMainForm); //LABEL B

        ApplicationMainForm.tabControl1.TabPages.Add("MyPage"); //LABEL A
    }
}

How can i get the form to display my Tabpage?
My TabPage is displayed when the Lines A and B change position. Am i missing an update method, oder is the TabPage Add never called until the application closes?

Edit #1: Some minor edits.
Edit #2: Edited in some more examplecode.
Edit #3: Removed some earlier / irelevant points.
Edit #4: Found a hint and edited this information in

  • 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-21T21:58:03+00:00Added an answer on May 21, 2026 at 9:58 pm
    Form1.tabControl1.Controls.Add(myNewTabItem);
    

    The tab control is a collection of tab pages, so you add tab pages like you add any control to a collection. Note that the tabs show up in the order you add them.

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

Sidebar

Related Questions

Ok I am still learning this... I have Googled and done some research but
I have googled this a little and didn't really find the answer I needed.
I am new to Emacs. I have googled this but no good answer there.
I am sure I am just missing something. But I have googled this for
I need to replace a string in certain documents. I have googled this code,
First of all, I know there are a lot of questions about this topic.
I'm trying to use this solution but Eclipse still cant resolve Attachment and DataService.
Have struggled with this call for a while now but i can't get it
I can't seem to get this to work, Basically, what I want to do
I have been searching Google and implementing different methods to try and get this

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.