Solved

Make a tabControl visible and reorder the the way they appear

Posted on 2002-06-27
4
370 Views
Last Modified: 2012-06-22

Hi
I have a user control with a tabControl
In this Tab Control I have I collection of tabPages.

Eg tabAddress,tabContact,TabAppointment

What I would like to do in my user control is to have a property that makes this tabs invisible or visible and then appear in the order I want.
Any help with an example will be appreciated!

I thought of  this in the user control but this will make the all control visible how can I make it so that only a particular tab is visible?

Public Property IsVisible() As Boolean
        Get
            Return mbIsVisible
        End Get
        Set(ByVal Value As Boolean)
            mbIsVisible = Value
        End Set
    End Property

Thanks
Gabriel
0
Comment
Question by:Gabriel_Brienza
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
kpkp earned 20 total points
ID: 7113937
How about adding a second tab control to you control, tabControl2.  Make tabControl.Visible = false.  

You could then move the tab that you want to hide to it, and move it back to make it visible again.  This way you can still create your tab pages at design time using the ide.

System.Windows.Forms.TabPage pageToHide = tabControl1.TabPages[0];
tabControl2.TabPages.Add(pageToHide);
tabControl1.TabPages.Remove(pageToHide);

System.Windows.Forms.TabPage pageToShow = tabControl2.TabPages[0];
tabControl1.TabPages.Add(pageToShow);
tabControl2.TabPages.Remove(pageToShow);




Of course you could use your own collection (hashtable or something) to store the TabPages, you don't have to create an second invisible tab control.

0
 

Author Comment

by:Gabriel_Brienza
ID: 7114086
Thanks for your reply.
But i think your idea could work however I am told to make a particular page in my tabcontrol visible of invible and reorder them when the developer uses my control.Ideally I should not be using 2 tabs.
Is this the only way to do it ?
How about to make that particular page visible or invisible by setting only a property.How could i do that in my usercontrol?
Sorry for being difficult

Thanks
Gabriel
0
 
LVL 4

Expert Comment

by:kpkp
ID: 7115736
if you make the second tab invisible, but setting its visible property to false, you should get the same effect, you would only see one tab control on the screen
0
 

Author Comment

by:Gabriel_Brienza
ID: 7190082
I think at moment this is the only way to make the tabs work.
Thanks for your help
Gabriel
0

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

16 Experts available now in Live!

Get 1:1 Help Now