Making tabcontrols 'visible' or 'invisible'

I have a tab control called EmployeeMaint.

Contained within are several individual tab pages.

I wish to be able to manipulate the pages so that depending on some data item (WS-COMP-ID) various 'pages' are either visible or not when the tab control displays for the first time.

eg. if ws-comp-id = 'fred'

      make tabpage 'fred1' invisible

     else

     if ws-comp-id = 'joe'

    make tabpage 'joe1' invisible

    end-if.

Whats the code to do this?

 

  • Verified Answer

    Each of the tabPages are actually separate controls that make up the tabPage Collection on the main tabControl.

    You can change the properties of these pages individually, including their names by clicking on them in the designer or in the properties for the tabControl itself you can click on the tabPages collection.

    There are several ways of removing and inserting these tabPages dynamically at run-time.

    following will remove the tabPage named tabPage2 from the collection

             invoke tabControl1::TabPages::Remove(tabPage2)

    following will insert the tabPage named tabPage2 back into the collection at index 1 (2nd position)

              invoke tabControl1::TabPages::Insert(1, tabPage2)