disabling and enabling tabs in a tag control.

Posted on 2008-06-13
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 500 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 69

Expert Comment

by:Éric Moreau
ID: 21786298

Author Comment

ID: 21786330
ii am stuck. I already did.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now