Select Tab Page That Has Been Added At Runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gobblegob
    New Member
    • Dec 2007
    • 133

    #1

    Select Tab Page That Has Been Added At Runtime

    Hi Guys,

    I add my tab pages at runtime, I am trying to select a tab from a sub.

    This is how i generate my tabs
    Code:
            Dim tp As New TabPage("User Management")
            Dim f2 As New fmUserManagement
            f2.TopLevel = False ' REQUIRED
            f2.FormBorderStyle = Windows.Forms.FormBorderStyle.None ' optional
            f2.Dock = DockStyle.Fill ' optional
            tp.Controls.Add(f2)
            f2.Show()
            TabControl1.TabPages.Add(tp)
    this does'nt select any tab...
    Code:
    AdminParent.TabControl1.SelectTab("User Management")
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    EDIT:

    The text you pass in the constructor is NOT the Name property. You need to set the Name property to the "User Management" string

    Forget this:
    When do you populate the tabs and when do you call select?

    Comment

    Working...