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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Controls Part II

Status
Not open for further replies.

MartinCroft

Programmer
Jun 12, 2003
151
GB
Tabcontrols seem to be black art, there does not seem to be much usual info around for them

I wanted to hide & show certain tabs thats been answered
but when I hide and show the tab that has been shown does not get the focus

I would have thought

tabcontrol.focus()

or even

TabControl.TabPages.Item(1).Focus()

but nothing makes any difference

anyonce know how i can by clicking on button
call any tab within the collection

Cheers

 
TabControl1.TabPages.Remove(TabPage2) 'to hide
TabControl1.TabPages.Add(TabPage2) 'to show
TabControl1.SelectedTab = TabPage2 'to select it


When you add the hiden tabpage in the collection then it will be shown at the end. So you can also do something like the next:

TabControl1.SelectedIndex = (TabControl1.TabPages.Count - 1)
 
Mysticmart,
I am not sure if this answers your question but have you tried the following
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim page As TabPage
page = TabControl1.SelectedTab()
If page.Name = "TabPage1" Then
TabControl1.SelectedTab = TabPage2
Else
TabControl1.SelectedTab = TabPage1
End If
End Sub
To select other tabs just increase the if statement or change it to a 'Select' statement

cheers,
Infacta

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top