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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:16:27+00:00 2026-06-06T20:16:27+00:00

I’ve just discovered that TabPages don’t resize with a TabControl until after they’re selected.

  • 0

I’ve just discovered that TabPages don’t resize with a TabControl until after they’re selected. This is a big problem for me because I have a panel that’s anchored on all four edges and shared – by setting its Parent property – between two of several pages on a TabControl that is fill-docked to a resizable form. So, if I select a tab that never contains the panel, resize the form, and then select a tab that will contain it but doesn’t presently, the panel doesn’t get resized.

I’ve found that fill-docking the panel rather than anchoring it works okay, but I’d rather avoid that if at all possible, as the shared panel doesn’t extend to the edges of the pages and its size can vary, so I’d have to mess around with the padding size of each page rather than simply altering the panel’s size.

I’ve tested this in both VB and C# and they both behave the same way. I thought the solution given for this known bug might do the trick, but unfortunately it doesn’t.

Is there anything else I can do, such as force the pages to resize, to get around this problem?

EDIT – Steps to reproduce this in VS 2010:

  • Add a TabControl to a resizable form, fill-dock it and add a third tab.

  • Add a Panel to the 3rd tab, leaving plenty of space at the sides, anchor it to all four edges and set its BackColor to something different than the tabPage’s so you can see it at runtime.

  • Add this line of code to the SelectedIndexChanged event:

VB

If TabControl1.SelectedIndex > 0 Then Panel1.Parent = TabControl1.SelectedTab  

C#

if (tabControl1.SelectedIndex > 0) panel1.Parent = tabControl1.SelectedTab;
  • Run/debug the form and resize it whilst the 1st tab is selected.

  • Select the 2nd tab – you will see the panel hasn’t resized.

  • 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-06T20:16:28+00:00Added an answer on June 6, 2026 at 8:16 pm

    As a workaround Hans Passant suggested I put the panel on the first TabPage (hidden) then set its Visible property in the event handler. As I explained, that wouldn’t quite work – as it isn’t just a “once-only” problem at start up; it occurs whenever the form is resized while a non-panel-displaying tab is selected, then selecting the panel-displaying tab that doesn’t currently contain the panel – but it did point me in the right direction for the answer. Which is to set the panel’s Visible property according to which tab is selected and always move the panel to the selected tab, regardless of whether the panel is displayed on it – EG:

    Private Sub TabControl1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
        Panel1.Visible = (TabControl1.SelectedTab Is TabPage2) OrElse (TabControl1.SelectedTab Is TabPage3)
        Panel1.Parent = TabControl1.SelectedTab
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.