title: Select a particular tabpage if already open in VB.NET
body: <p>I have created a tab control and few forms. Each form opens in a separate tab when a button is clicked  </p>
  
  <p>I have take care so that the form does not open again in a new tab if its already open. But I am having trouble bringing the tab to focus.</p>
  
  <p>I want to Select the From in the tab and bring it to focus if its already in the tab list.</p>
  
  <p>Here is my Code</p>
  
  <pre><code> //Function to open form in new tab
  Private Sub openFormInTab(ByVal sender As Form, ByVal tp As TabPage)
      sender.TopLevel = False ' REQUIRED
      sender.FormBorderStyle = Windows.Forms.FormBorderStyle.None ' optional
      sender.Dock = DockStyle.Fill ' optional
      tp.Name = sender.Name
      tp.Controls.Add(sender)
      sender.Show()
      ProjectTabControl.TabPages.Add(tp)
      Me.ProjectTabControl.SelectedTab = tp
    End Sub
  
  //Function to determine if the form is already open.
  
  Public Function FormOpen(ByRef frmName As String) As Boolean
      For Each page As TabPage In ProjectTabControl.TabPages
        If page.Name = frmName Then
          Return True
        End If
      Next page
      Return False
    End Function
  
  //I need function to bring the form to focus if its already open.
  </code></pre>
  
  <p>Thanks in advance.</p>