Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7690775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:28:26+00:00 2026-05-31T20:28:26+00:00

I’m trying to enable tabs functionality in the WebBrowser control. I have a TabControl

  • 0

I’m trying to enable tabs functionality in the WebBrowser control. I have a TabControl hosting WebBrowser controls in each tab. And a multiline enables Textbox to enter the sites. It looks something like this,

enter image description here

An this is the code I have.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim m As String()
        Dim w As New WebBrowser
        Dim i As Integer

        TabControl1.TabPages.RemoveAt(0)

        m = TextBox1.Text.Split(Environment.NewLine)

        For Each k As String In m
            TabControl1.TabPages.Add(i, k.Trim)
            TabControl1.SelectedTab.Controls.Add(w)
            w.Dock = DockStyle.Fill
            w.Navigate(k)
            i = i + 1
        Next

    End Sub
End Class

Its supposed to take each string(URL) and execute them in separate tab. It opens up the correct number of tabs according to the user input. However it only executes the last URL.

I think I have an idea as to what’s wrong here. This line

TabControl1.SelectedTab.Controls.Add(w)

It adds the WebBrowser control to the TabControl at the SelectedTab position. Since the default selected tab is the first, it only adds it to the first tab therefore executing only that browser.

I want to know how I can select the next tab from the loop as the SelectedTab so that when the loop runs again and again, it would keep adding WeBrowser controls to each tab.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:28:27+00:00Added an answer on May 31, 2026 at 8:28 pm

    In your example you need to move the creation for ‘w‘ (WebBrowser) into the For Each loop. You are using one instance of ‘w‘ that is essentially moved into between the tabs whilst the loop executes.

    You want something like this

    For Each k As String In m
        Dim w As New WebBrowser() ' <-- Move the construction of WebBrower into the loop
        TabControl1.TabPages.Add(i, k.Trim)
        TabControl1.SelectedTab.Controls.Add(w)
        w.Dock = DockStyle.Fill
        w.Navigate(k)
        i = i + 1
    Next
    

    Also I’m unsure if TabPages.Add will update SelectedTab, you may want to consider constructing new instances of TabPage explicitly, within you loop to ensure you add the WebBrowser to the appropriate TabPage.

    Dim tabPage As New TabPage(url) ' <-- 'k' in your example
    tabPage.Controls.Add(w) 
    w.Dock = DockStyle.Fill
    w.Navigate(url) 
    TabControl1.TabPages.Add(tabPage) ' <-- Add the tabPage to the TabControl 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.