[VB.NET] TabControl

🚫
Exiled
Joined
Jan 21, 2009
Messages
34
Reaction score
2
Hi, im trying to make a good webbrowser im using tabcontrol BUT not the regular tabs.

Here is the tabs im using: http://www.codeproject.com/KB/vb/TabPages.aspx


My Question:

I wanna do so when ToolStripButton8 is clicked a new tab is added (this works) and i want the new tab to be selected.

Here's my code:
Code:
        On Error Resume Next
        Dim browse2 As New WebBrowser
        browse2.Name = "b2"
        browse2.Dock = DockStyle.Fill
        AddHandler browse2.DocumentCompleted, AddressOf browse2_done
        AddHandler browse2.DocumentCompleted, AddressOf browse2_text
        AddHandler browse2.Navigating, AddressOf browse2_status
        Me.ctlTabPages.Add(New TabPages.TabPage("Tab " & Me.ctlTabPages.Count + 1 & "'s Caption", lbl, "Created: "))
        ctlTabPages.CurrentPage.Control.Controls.Add(browse2)

Now how do i make the new tab selected?

BTW.. ctlTabPages is TabControl1.
BTW... ctlTabPages.SelectTab doesnt work.
 
Last edited by a moderator:
I don't know crap about VB, but in some cases in C# you gotta focus the thingie first before you it can be selected.

So try adding ctlTabPages.Focus or something similiar before ctlTabPages.SelectTab.
 
Back