Link to home
Create AccountLog in
Avatar of mathieu_cupryk
mathieu_cuprykFlag for Canada

asked on

disabling and enabling tabs in a tag control.

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
ASKER CERTIFIED SOLUTION
Avatar of scgstuff
scgstuff
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of mathieu_cupryk

ASKER

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

Avatar of Éric Moreau
ii am stuck. I already did.