Solved

disabling and enabling tabs in a tag control.

Posted on 2008-06-13
4
285 Views
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

this.MainTabControl.TabPages.Add(CreateUpdatePriceListTab);
this.MainTabControl.SelectTab(1);

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.



disabletab.jpg
selectprice.jpg
0
Comment
Question by:mathieu_cupryk
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
scgstuff earned 500 total points
Comment Utility
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:

Shawn

        private void button1_Click(object sender, EventArgs e)

        {

            this.tabControl1.TabPages.Remove(tabPage2);

            this.tabControl1.TabPages.Remove(tabPage3);

            this.tabControl1.TabPages.Remove(tabPage4);

        }
 

        private void button2_Click(object sender, EventArgs e)

        {

            this.tabControl1.TabPages.Add(tabPage2);

            this.tabControl1.TabPages.Add(tabPage3);

            this.tabControl1.TabPages.Add(tabPage4);

        }

Open in new window

0
 

Author Comment

by:mathieu_cupryk
Comment Utility
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.
                 HideTabs();
        }

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.
        }

0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
0
 

Author Comment

by:mathieu_cupryk
Comment Utility
ii am stuck. I already did.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

7 Experts available now in Live!

Get 1:1 Help Now