Results 1 to 10 of 10

Thread: [RESOLVED] Tabbed web browser error

  1. #1

    Thread Starter
    Junior Member ryanguy426's Avatar
    Join Date
    May 2013
    Posts
    22

    Resolved [RESOLVED] Tabbed web browser error

    Hello all! I'm currently in the process of re-writing a web browser I had.

    Everything has been going well until now. The tab control is being a pain. The video I uploaded below will show you what I mean.



    Is there any way I could fix this? It is really annoying, and I haven't found any way to resolve this myself.

    Any help would really be nice!


    Thank you for taking your time to read my post.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Tabbed web browser error

    It's got nothing to do with the tab control. You haven't added a webbrowser control to the new tab so it's not surprising that telling the non-existent control to navigate results in an error. As you've chosen the least helpful way to give us a view of your problem I'm not able to say exactly how you should go about correcting it in specific terms but the gist of it is simply add a new control to each tab page as it's created. Nothing comes of nothing!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Junior Member ryanguy426's Avatar
    Join Date
    May 2013
    Posts
    22

    Re: Tabbed web browser error

    I posted a youtube video of the problem in action. How would that be not helpful?

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Tabbed web browser error

    Quote Originally Posted by ryanguy426 View Post
    I posted a youtube video of the problem in action. How would that be not helpful?
    Well let's see. It's difficult (near impossible for anyone with eyes as old as mine!) to read the code and impossible to copy it. In this case the only code we get to see is actually the least important (it doesn't show the cause of the error only the incidence of it). We have to plough through 1:37 of material, the bulk of which is faffing around doing nothing meaningful and, although I've no objection myself, we have to connect to YouTube which not everybody in the Universe is happy about. A clear statement of the problem, a readable recitation of the error message, and a properly formatted code snippet would help us to help you far, far better.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Tabbed web browser error

    The problem is, as dunfiddlin mention, that you don't add any webbrowser control to the new tab. Show us the code you're using to create the new tab.

  6. #6

    Thread Starter
    Junior Member ryanguy426's Avatar
    Join Date
    May 2013
    Posts
    22

    Re: Tabbed web browser error

    The code I am using to create a new tab would be:

    Code:
     Private Sub AddTabToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AddTabToolStripMenuItem.Click
            Dim Browser As New WebBrowser
            TabControl1.TabPages.Add("New Page")
            Browser.Name = "Derp Explorer"
            Browser.Dock = DockStyle.Fill
            TabControl1.SelectedTab.Controls.Add(Browser)
            AddHandler Browser.ProgressChanged, AddressOf loading
            AddHandler Browser.DocumentCompleted, AddressOf done
    
        End Sub
    EDIT: Fixed code. Put in the wrong one before.
    Last edited by ryanguy426; May 18th, 2013 at 08:03 PM.

  7. #7
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Tabbed web browser error

    You're adding the browser to the SelectedTab but that tab is not the same as the newly created tab. Try this:
    Code:
        Dim tabPage As New TabPage
        tabPage.Text = "New Page"
        TabControl1.TabPages.Add(tabPage)
        TabControl1.SelectedTab = tabPage

  8. #8

    Thread Starter
    Junior Member ryanguy426's Avatar
    Join Date
    May 2013
    Posts
    22

    Re: Tabbed web browser error

    Thanks. That works. But when I open the new tab, and try to navigate to a new website, it freezes and then I get this:

    Name:  issue.PNG
Views: 134
Size:  118.2 KB

    I really don't understand what's causing this problem?

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Tabbed web browser error

    The error is saying that there is no child control on the tab. You still must do something wrong, the code I posted was only to create the tab and set focus to it, you obviously still need to add the webbrowser control to it.
    Code:
        Dim browser As New WebBrowser
        Dim tabPage As New TabPage
        tabPage.Text = "New Page"
        TabControl1.TabPages.Add(tabPage)
        TabControl1.SelectedTab = tabPage
        tabPage.Controls.Add(browser)
        browser.Dock = DockStyle.Fill
        AddHandler browser.ProgressChanged, AddressOf loading
        AddHandler Browser.DocumentCompleted, AddressOf done

  10. #10

    Thread Starter
    Junior Member ryanguy426's Avatar
    Join Date
    May 2013
    Posts
    22

    Re: Tabbed web browser error

    Thanks a dozen! Joacim! It fixed the crash! Now I can continue on the project! I'm so glad the forums exist!

    Marked as resolved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width