Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use a TabStrip?

Status
Not open for further replies.

Boxster1987

Programmer
Aug 9, 2002
19
0
0
US
I've been trying to make a program for some time now that utilizes a TabStrip, but I can't figure out just how to use it. Could somebody please help me?!?!?

Thanks
 
The TabStrip can be tricky because you maybe expect it to be a container but it's not. If you want to design tabs on a form where each tab's content looks different, use the SSTab control that ships with VB.

The TabStrip control, in my view, is useful mainly where you are displaying the same type of thing within the control but you need different 'headings'.

For example, imagine you have a TabStrip and it contains boxes to enter an address. Your tabs might say "Home", "Work", "Parent's". Depending on the tab that is clicked, you display a different address, but the basic layout is always the same.

To add tabs, simply use TabStrip1.Tabs.Add ...

To work with the selected tab, use TabStrip1.SelectedTab

Remember that Tabs start at 1, not 0.

Bear in mind that some VB controls, such as a Label, will always disappear behind a TabStrip and can't be forced onto the top of it, so if you want to draw labels and things on your TabStrip you might want to place them in a PictureBox or SSPanel container first, and then stick that inside the TabStrip control.

- Andy.
 
Hi Freinds, I still new in usinf tabstrip and need your help.

exiting i have a tabstrip in a form and I had creats a 3 frame or tabs in this, in design time i will need to put in some text box and label in first tab, how to switch to second tab for design time?

When I click on the second tab it's won't work or jump to second tab for me to design. Why?
 
Hi Vincentan,

The TabStrip control cannot be used at Design-Time to set different controls on each tab, you must do that entirely programatically.

What you need to use is the Microsoft Tabbed Dialog Control which allows you to place controls on each Tab at design time.

- Andy
 

>When I click on the second tab it's won't work or jump to second tab for me to design

Just click on that frame , and the press CTRL-J
 
Hi CCLINT,

What does CTRL-J do on your machine, because on mine it does absolutely nothing!


- Andy
 
Yes, Me too, is there any place to set this contol for ctrl-J for switch to another frame for design?
 
You must click on the frame in the background first (say you have two frames and one covers the 2nd one partially.
If you click on the second one and press Ctrl-J, that should bring if to the front, so that the first one is now behind the second one.
Same as the menu point:

FORMAT|ORDER|To the Front

(or what ever it is in english)
 
Unless you actually mean the tab itself, in which case I mis-understood.

For that just click on the tab strip and use the right mouse button and select: Properties.
Then on the second register tab, select the tab you want to change properties for.
 
Hi CCLINT, is that mean we only able to change the property of the second tab in property pages?

So this will be as Andy what he mention for to use is the Microsoft Tabbed Dialog Control which allows me to place controls on each Tab at design time but how to use Microsoft Tabbed Dialog Control in a form and tabscrip?

Sorry for any inconvenian because I beginner for using the tabscrip.
 
>is that mean we only able to change the property of the second tab in property pages

You can change the property of any tab.
When you click on the register for the tabs, in the above described method, you will see arrows by the Index. Click the arrow to go to the desired index.
 
Hi,

No, using a TabStrip you CANNOT place controls on the second, third etc. tabs, they are not containers. A TabStrip is mostly used when the content of each tab is the same layout, OR when the programmer stores the controls for each tab in a container (such as Picture or a Frame) and places them over the TabStrip as the user clicks between tabs.

Use the Tabbed Dialog control, it will do exactly what you want.

- Andy
 
I think this is a matter of perception, and possibly mis-understandings.

The the properties for the individual tabs on a Tab Strip can be set as I have mentioned.
Frames are used to hold the controls for groups.
If you want to place a control on frame #2, you click on it and bring it to the from, if it happens to be hidden behind another object, and simply place your controls on it.
No one didn't say that the Tab strip is actually a container, and the original question by Vincentan was different. It may have just been that they thought it would act as the SSTab container control.

When you run your program, you of course will only want one frame to be visible - the frame which corrsponds to the selected tab. Here you just hide all of the frames by setting their Visible property to false, and then make the one visible which corresponds to the tab index.
No problem here. Also no problem just using the SSTab control.
But the question was:

>in design time i will need to put in some text box and label in first tab, how to switch to second tab for design time?

So, you do not do this by clicking on the tab, but by clicking on the frame which corresponds to the tab index.

If you have 3 tabs (index 1 to 3), then it is best to have a control array of three frames also indexed 1 to 3.

The TabStrip is just as easy to use as a SSTab. You only need a little tiny bit of code to show/hide the tabs as needed (actually, you should use Frames with the SSTab as well, and this hiding/showing of the individual frames should also be done for a SSTab control as well).
However, the biggest advantage using the SSTab control is more of ease during design.
The SSTab control is actually intended as an option selection control.
 
Hi CCLINT,

I agree with what you've said. I think I simply read the question as coming from a user who has created a TabStrip with 3 tabs and can't understand why he can't switch to the second or third tabs at design time in order to place controls on them.

Like you say, using a control array of frames is the easiest way to achieve the solution and does only require a few lines of code, however using the Tabbed control is probably easier and more intuitive for a beginner.


- Andy
_______________________________
"On a clear disk you can seek forever"
 
I think you are right(1.) and agree(2.) with it.
 
Hi CCLINT & ANDY, your are great.. and thanks for your help, as Andy mention for Tabbed Dialog control, is this actually is a component which need to be add in? or is just need program coding?

How ever, I would like to try SSTab control and may any one kindly please teach me how to add in this control?

Thanks!
 
Just for clarification, the "MS Tabbed dialog" is the SSTab.
Add by seleting the "Microsoft Tabbed Dialog Control" from the components list under menu:
PROJECT|COMPONENTS
It will then be added to the toolbox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top