A first chance exception of type 'System.NullReferenceException' occurred in Web Browser.exe
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll
See #77 - these aren't errors being raised in your application, just in the .net framework. They can be resolved but basically they aren't going to stop your code running, unlike a runtime exception within your own code.
There is an option to turn off these messages somewhere but I can't recall where off the top of my head.
no worries anyways thanks for helping me but im just gonna give up on tabs and it get it back running again
I have created a new project with a new form containing 6 buttons called button 1 to button 6, a combo box called combobox1, a tab control called tabcontrol1 with 1 page called tabpage1, and 2 timer controls called timer1 and timer2.
Then I pasted in the code that you provided above in post #61, and changed the webbrowser1 references to ActiveBrowser in buttons1 -6, deleted that line that caused the infinite loop, and ran the code :
All works fine, with multiple tabs
(thats a slight fib - there is one more line that needs adding to get it working perfectly, but that is unrelated to webbrowser1 not working) :
Code:
Dim X As New TabPage
X.Text = "My New Page "
TabControl1.TabPages.Add(X)
Dim Y As New WebBrowser
Y.Dock = DockStyle.Fill
AddHandler Y.Navigated, AddressOf WebBrowser1_Navigated
AddHandler Y.DocumentCompleted, AddressOf WebBrowser1_DocumentCompleted
X.Controls.Add(Y)
Note obviously I don't have your graphics on the buttons so you'll need to work out what each one does, and I've moved the code to create a new tab into a 7th button on the side of the tab control
No problem... do you think you understand the process of creating controls dynamically now?
Creating a control in code like we did with "Dim Y as New WebBrowser" is exactly what Visual Studio does for you behind the scenes when your create a control via the designer. There is a hidden file associated with every form which just consists of code exactly like that - to see it you click on the "Show All Files" button in the Solution explorer toolbar and then click on the "+" icon that appears next to your form and then you will see a Form1.Designer.Vb icon - double click that and you'll see the code that VB has generated for you automatically to create the controls.
yay followed your project and mine worked ermm just got one slight problem tho
Code:
Try
ActiveBrowser.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Stop
Return
End Try
How do I get that Stop comming Up In yellow when i deburg it
it says this on me immediate window on error console
A first chance exception of type 'System.NullReferenceException' occurred in Web Browser 2.exe
The command "STOP" breaks execution of your code at that point and opens the debugger. I put it in there because you are just ignoring possible exceptions that might be important - the fact that it is running that line suggests there is a problem somewhere. It may be that you just want to ignore it, in which case just remove that line.
And as I said before "A first chance exception of type 'System.NullReferenceException' occurred in Web Browser 2.exe" is not an error in your code necessarily.
yea i took out that line and it comes up for all these listed in yellow too
But Me First tab Wont Work With All these errors
ActiveBrowser.Stop()
ActiveBrowser.GoForward()
ActiveBrowser.GoBack()
ActiveBrowser.Refresh()
ActiveBrowser.GoHome()
ActiveBrowser.Navigate(ComboBox1.Text)
Sorry you'll need to be more specific. Do you get these "yellow" lines in the project I gave you or just your own?
I have no idea what you mean by
But Me First tab Wont Work With All these errors
ActiveBrowser.Stop()
ActiveBrowser.GoForward()
ActiveBrowser.GoBack()
ActiveBrowser.Refresh()
ActiveBrowser.GoHome()
ActiveBrowser.Navigate(ComboBox1.Text)
I don't mean to appear rude but you need to be very precise and specific if you want someone to work out what is happening, vague statements just don't give any meaningful information.
Does the problem occur with my version, or just in your version? I don't get the problem in the code I sent you.
If it only occurs in your version then I think its something to do with your initial form setup.
I've tried on the version - specifically testing button5 - that I sent you and it seems to be working OK.
It may be worth taking the project I sent you and adding your graphics into that version and re-arranging the controls to suit, rather than persisting with your project as it sounds like something has gone wrong in the setup of the form you created.