[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.
http://youtu.be/EwYWkaBght4
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.
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!
Re: Tabbed web browser error
I posted a youtube video of the problem in action. How would that be not helpful?
Re: Tabbed web browser error
Quote:
Originally Posted by
ryanguy426
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.
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.
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.
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
1 Attachment(s)
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:
Attachment 100309
I really don't understand what's causing this problem? :confused:
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
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.