disabling and enabling tabs in a tag control.

Posted on 2008-06-13
Medium Priority
Last Modified: 2013-12-17
I have four tabs see image attached.
1. On load of the form I disable three of them using:
            this.MainTabControl.TabPages.RemoveAt(1); // Update invisible until a row is selected or create button is clicked.
            this.MainTabControl.TabPages.RemoveAt(1); // Error/Warning invisible until Load is completed.
            this.MainTabControl.TabPages.RemoveAt(1); // Compare invisible until compare button is pressed.

So now I am left with one tab which is the SelectPriceListTab

Now if the user presses the create button then I want to enable the second tab button


So if I am in the selecttab disable all three tabs otherwise if I click on the datagrid row or create button on the selecttab then
show createupdatetab.
see two images.

Question by:mathieu_cupryk
  • 2

Accepted Solution

scgstuff earned 2000 total points
ID: 21785818
OK, Here is how you can remove and re-add the tab pages....  I have created a test page with 2 buttons and can when you click on button1 it removes tab 2 3 and 4 and then button 2 adds them back.  Whe you re-add, everything that was orginially there is still there.

Try this:


        private void button1_Click(object sender, EventArgs e)
        private void button2_Click(object sender, EventArgs e)

Open in new window


Author Comment

ID: 21786194
but if user is changes the tab

 private void MainTabControl_Selected(object sender, TabControlEventArgs e)
          if MainTabControl. is  SelectPriceListTab /// =====> what should be the syntax here.

private void HideTabs()
            this.MainTabControl.TabPages.Remove(CreateUpdatePriceListTab); // Update invisible until a row is selected or create button is clicked.
            this.MainTabControl.TabPages.Remove(ErrorWarningsTab);       // Error/Warning invisible until Load is completed.
            this.MainTabControl.TabPages.Remove(CompareResultsTab);      // Compare invisible until compare button is pressed.

LVL 70

Expert Comment

by:Éric Moreau
ID: 21786298

Author Comment

ID: 21786330
ii am stuck. I already did.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question