|
-
Jul 20th, 2009, 07:41 AM
#41
Re: WebBrowser Tabs
OK Like I said above your existing code refers to WebBrowser1 throughout, and in order to get it to work with any one of multiple browsers you need to change that code.
For example :
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(ComboBox1.Text)
WebBrowser1.WebBrowserShortcutsEnabled = True
End Sub
This code can be adapted to use the webbrowser control on the currently selected tab. If you are always only going to have just the webbroswer on each tab (ie no buttons or anything else) you can simply do this :
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).Navigate(ComboBox1.Text)
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).WebBrowserShortcutsEnabled = True
End Sub
Is there any chance you will ever have any other controls or there or will it only ever be the webbrowser on each tab?
-
Jul 20th, 2009, 08:15 AM
#42
Thread Starter
Addicted Member
Re: WebBrowser Tabs
i might have other controls on you see i want it to look a bit like IE8
i got this error too
-
Jul 20th, 2009, 08:21 AM
#43
Re: WebBrowser Tabs
OK that error implies you have a tabpage there with no controls on it at all.
You'll need to look at that and check that all tabs have a control on them
I'll sort you out an alternative example code that will work with multiple controls on a tab
-
Jul 20th, 2009, 08:26 AM
#44
Thread Starter
Addicted Member
Re: WebBrowser Tabs
ermm so what do i need to check for ?? like code highlight please bro
-
Jul 20th, 2009, 08:28 AM
#45
Re: WebBrowser Tabs
Try this instead :
Code:
For Each Target As Control In TabControl1.SelectedTab.Controls
If TypeOf (Target) Is WebBrowser Then
CType(Target, WebBrowser).Navigate(ComboBox1.Text)
CType(Target, WebBrowser).WebBrowserShortcutsEnabled = True
Exit For
End If
Next
I'm sure this can be simplified by using Controls.OfType(WebBrowser) to just get a collection of webbrowsers, but I can't seem to get that working off the top of my head.
-
Jul 20th, 2009, 08:29 AM
#46
Re: WebBrowser Tabs
 Originally Posted by pillhead2007
ermm so what do i need to check for ?? like code highlight please bro
No code, just using your eyes!
Take a look at the tab control in the designer window - look and see if you have a tabpage with no controls on it.
-
Jul 20th, 2009, 08:57 AM
#47
Thread Starter
Addicted Member
Re: WebBrowser Tabs
sort of got it working but now it wont got to any sites i want it to go help help please
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each Target As Control In TabControl1.Controls
If TypeOf (Target) Is WebBrowser Then
CType(Target, WebBrowser).Navigate(ComboBox1.Text)
CType(Target, WebBrowser).WebBrowserShortcutsEnabled = True
Exit For
End If
Next
End Sub
Private Sub ComboBox1_KeyDown_(ByVal sender As Object, ByVal e As KeyEventArgs) Handles ComboBox1.KeyDown
If (e.KeyCode = Keys.Enter) Then
Navigate(ComboBox1.Text)
End If
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
ComboBox1.Text = WebBrowser1.Url.ToString()
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).Navigate(ComboBox1.Text)
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).WebBrowserShortcutsEnabled = True
End Sub
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
WebBrowser1.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoBack()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.GoForward()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Refresh()
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
WebBrowser1.Stop()
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.GoHome()
WebBrowser1.Navigate("sharewarez.sqweebs.com")
ProgressBar1.Increment(1)
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Function IsPopupWindow() As Boolean
On Error Resume Next
If WebBrowser1.Document.ActiveElement.TagName = "BODY" Or WebBrowser1.Document.ActiveElement.TagName = "IFRAME" Then
IsPopupWindow = True
Else
IsPopupWindow = True
End If
End Function
Private Sub ComboBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
Dim X As New TabPage
X.Text = "My New Page "
TabControl1.TabPages.Add(X)
Dim Y As New WebBrowser
Y.Dock = DockStyle.Fill
X.Controls.Add(Y)
End Sub
End Class
-
Jul 20th, 2009, 09:01 AM
#48
Re: WebBrowser Tabs
I'm going to pretend that the URLs you are looking at aren't full of hacks, cracks and keygens, as it is against the acceptable usage policy of the forum to help with projects relating to such nefarious activities.
The reason why your new webbrowsers wont navigate yet is because you have other code that still refers to WebBrowser1, so you need to change those.
A prime candidate being the Navigate function you've got there - you need to rewrite the references in there to work with the webbrowser of the current tab, just like you did earlier with the button click event.
-
Jul 20th, 2009, 09:04 AM
#49
Thread Starter
Addicted Member
Re: WebBrowser Tabs
no i mean google doesnt even wanna load now
-
Jul 20th, 2009, 09:05 AM
#50
Thread Starter
Addicted Member
Re: WebBrowser Tabs
so what kinda of code do i need to write in the navigate and navigated codes ?
-
Jul 20th, 2009, 09:08 AM
#51
Thread Starter
Addicted Member
Re: WebBrowser Tabs
also if u look at the top left hand corner where tabs are on the last image on post 47 you can see that its a small window on tabs that has been navigated how do i get that to show like webbrowser 1
-
Jul 20th, 2009, 09:16 AM
#52
Re: WebBrowser Tabs
 Originally Posted by pillhead2007
so what kinda of code do i need to write in the navigate and navigated codes ?
The code itself is fine, it is just that you always refer to WebBrowser1 which is the one on the 1st tab, and is fine when there is only one of them. Now you have multiple webbrowsers you need to refer to the correct one each time - the correct one being the one on the selected tabpage of the tab control.
Which is exactly what we did with the button1_click event - you just need to do the same thing for the Navigate function.
Events like Navigated are slightly different but we can worry about that once you've got the new browsers navigating - one step at a time remember?
-
Jul 20th, 2009, 09:21 AM
#53
Thread Starter
Addicted Member
Re: WebBrowser Tabs
what do i need to add in or change in this code Then Please tell me once ive got this sorted im saving the script lol for future reference lol
Code:
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
WebBrowser1.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
-
Jul 20th, 2009, 09:27 AM
#54
Re: WebBrowser Tabs
Well what we did before was chenge the reference from "WebBroser1.Navigate" to reference the active browser (ie the one on the selected tab page)
To make life simpler lets create a function which will return a reference to the "active" browser :
Code:
Private Function ActiveBrowser() As WebBrowser
For Each Control In TabControl1.SelectedTab.Controls
If TypeOf Control Is WebBrowser Then
Return CType(Control, WebBrowser)
End If
Next
End Function
Now wherever you see WebBrowser1 in the body of an event or procedure you need to replace WebBrowser1 with ActiveBrowser, ie
Code:
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
ActiveBrowser.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
So you need to sweep through your code and do that replacement. What you shouldn't do though is change anything in an event declaration, so leave lines like this :
Code:
Private Sub WebBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
Alone
-
Jul 20th, 2009, 09:40 AM
#55
Thread Starter
Addicted Member
Re: WebBrowser Tabs
Got this Code And Can You Please tell Me If My Code Is ok too
Warning 1 Function 'ActiveBrowser' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. C:\Users\Chris\Documents\Visual Studio 2008\Projects\Web Browser\Web Browser\Form1.vb 34 5 Web Browser
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each Target As Control In TabControl1.Controls
If TypeOf (Target) Is WebBrowser Then
CType(Target, WebBrowser).Navigate(ComboBox1.Text)
CType(Target, WebBrowser).WebBrowserShortcutsEnabled = True
Exit For
End If
Next
End Sub
Private Sub ComboBox1_KeyDown_(ByVal sender As Object, ByVal e As KeyEventArgs) Handles ComboBox1.KeyDown
If (e.KeyCode = Keys.Enter) Then
Navigate(ComboBox1.Text)
End If
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
ComboBox1.Text = ActiveBrowser.Url.ToString()
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).Navigate(ComboBox1.Text)
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).WebBrowserShortcutsEnabled = True
End Sub
Private Function ActiveBrowser() As WebBrowser
For Each Control In TabControl1.SelectedTab.Controls
If TypeOf Control Is WebBrowser Then
Return CType(Control, WebBrowser)
End If
Next
End Function
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
ActiveBrowser.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoBack()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.GoForward()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Refresh()
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
WebBrowser1.Stop()
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.GoHome()
WebBrowser1.Navigate("sharewarez.sqweebs.com")
ProgressBar1.Increment(1)
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Function IsPopupWindow() As Boolean
On Error Resume Next
If ActiveBrowser.Document.ActiveElement.TagName = "BODY" Or WebBrowser1.Document.ActiveElement.TagName = "IFRAME" Then
IsPopupWindow = True
Else
IsPopupWindow = True
End If
End Function
Private Sub ComboBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
Dim X As New TabPage
X.Text = "My New Page "
TabControl1.TabPages.Add(X)
Dim Y As New WebBrowser
Y.Dock = DockStyle.Fill
X.Controls.Add(Y)
End Sub
End Class
-
Jul 20th, 2009, 09:46 AM
#56
Re: WebBrowser Tabs
OK... its just a warning saying that if the active tab doesn't contain a webbrowser control then it will cause an error.
This should never happen, however to avoid getting the warning you can amend that function to :
Code:
Private Function ActiveBrowser() As WebBrowser
ActiveWebBrowser = Nothing
For Each Control In TabControl1.SelectedTab.Controls
If TypeOf Control Is WebBrowser Then
Return CType(Control, WebBrowser)
End If
Next
End Function
You should then in theory check that this function isn't returning "nothing" every time you call it, however as you personally can ensure that there is a webbrowser on each tab page it isn't really necessary, and if it does happen it would be useful to get an error thrown at this point so wouldn't bother doing that right now.
-
Jul 20th, 2009, 09:55 AM
#57
Thread Starter
Addicted Member
Re: WebBrowser Tabs
so what should i do , to make the tabs work if i cant get them to work i think i should do some training on visual basic get me up 2 scratch get me understanding you got any sites or any video tutorials ?? you could suggest ?
-
Jul 20th, 2009, 10:00 AM
#58
Re: WebBrowser Tabs
I've told you what you need to make them work. You're 95% of the way there now
I would certainly recommend doing some more training on VB as it never hurts to have a good grounding in the basics before embarking on any project. Couldn't point you at any specific tutorials really as its 15 years since I started learning from scratch!
-
Jul 20th, 2009, 10:25 AM
#59
Thread Starter
Addicted Member
Re: WebBrowser Tabs
yea ive done that to get that error away for now .. now what i do ?
-
Jul 20th, 2009, 10:33 AM
#60
Re: WebBrowser Tabs
Have you gone through and replaced the WebBrowser1 references with the ActiveBrowser references?
Specifically the button1 - button6 click events and IsPopupWindow function
Last edited by keystone_paul; Jul 20th, 2009 at 10:38 AM.
-
Jul 20th, 2009, 10:49 AM
#61
Thread Starter
Addicted Member
Re: WebBrowser Tabs
yea i think so here code to tell me if ive missed one
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each Target As Control In TabControl1.Controls
If TypeOf (Target) Is WebBrowser Then
CType(Target, WebBrowser).Navigate(ComboBox1.Text)
CType(Target, WebBrowser).WebBrowserShortcutsEnabled = True
Exit For
End If
Next
End Sub
Private Sub ComboBox1_KeyDown_(ByVal sender As Object, ByVal e As KeyEventArgs) Handles ComboBox1.KeyDown
If (e.KeyCode = Keys.Enter) Then
Navigate(ComboBox1.Text)
End If
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
ComboBox1.Text = ActiveBrowser.Url.ToString()
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).Navigate(ComboBox1.Text)
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).WebBrowserShortcutsEnabled = True
End Sub
Private Function ActiveBrowser() As WebBrowser
For Each Control In TabControl1.SelectedTab.Controls
If TypeOf Control Is WebBrowser Then
Return CType(Control, WebBrowser)
End If
Next
End Function
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
ActiveBrowser.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoBack()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.GoForward()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Refresh()
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
WebBrowser1.Stop()
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.GoHome()
WebBrowser1.Navigate("sharewarez.sqweebs.com")
ProgressBar1.Increment(1)
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Function IsPopupWindow() As Boolean
On Error Resume Next
If ActiveBrowser.Document.ActiveElement.TagName = "BODY" Or WebBrowser1.Document.ActiveElement.TagName = "IFRAME" Then
IsPopupWindow = True
Else
IsPopupWindow = True
End If
End Function
Private Sub ComboBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
Dim X As New TabPage
X.Text = "My New Page "
TabControl1.TabPages.Add(X)
Dim Y As New WebBrowser
Y.Dock = DockStyle.Fill
X.Controls.Add(Y)
End Sub
End Class
-
Jul 20th, 2009, 10:51 AM
#62
Thread Starter
Addicted Member
Re: WebBrowser Tabs
dont know which one to change coz you sed dont change the handles webbrowser1
-
Jul 20th, 2009, 10:54 AM
#63
Re: WebBrowser Tabs
Button1_Click, Button2_Click, Button3_Click, Button4_Click, Button5_Click, Button6_Click and IsPopupWindow.
These routines all refer do webbrowser1 as an object and need changing or they will always act on the web-browser on the 1st tab page regardless of which one is active.
Once you've done that let me know and I'll explain the next step.
-
Jul 20th, 2009, 11:47 AM
#64
Thread Starter
Addicted Member
Re: WebBrowser Tabs
ive done that but got an error for activeBrowser.Stop
-
Jul 20th, 2009, 11:49 AM
#65
Thread Starter
Addicted Member
Re: WebBrowser Tabs
ryt its done ?? whats next
-
Jul 20th, 2009, 12:09 PM
#66
Re: WebBrowser Tabs
OK when you create your new webbrowser we now need to add event handlers, so that the stuff that currently handles webbrowser1 events also works with your new ones, so you need to add this line :
Code:
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
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
X.Controls.Add(Y)
End Sub
Last edited by keystone_paul; Jul 21st, 2009 at 07:55 AM.
-
Jul 20th, 2009, 12:49 PM
#67
Thread Starter
Addicted Member
Re: WebBrowser Tabs
ermm what you mean add new web browser were do i add the new web browser do i stick it over the top of the other webbrowser 1
-
Jul 20th, 2009, 12:51 PM
#68
Re: WebBrowser Tabs
 Originally Posted by pillhead2007
ermm what you mean add new web browser were do i add the new web browser do i stick it over the top of the other webbrowser 1
Deep breaths... calm thoughts....
No, you (personally) do not add a new web browser, it is done in code. That is what this line of code does :
Code:
Dim Y As New WebBrowser
-
Jul 20th, 2009, 01:06 PM
#69
Thread Starter
Addicted Member
Re: WebBrowser Tabs
okies well next step then coz ive added that handler
-
Jul 20th, 2009, 01:08 PM
#70
Re: WebBrowser Tabs
That should be it, or at least thats the theory
Give it a whirl - see if it is working.
If you have a sizing issue still (ie the tabs not being wide enough) that can be sorted, but first need to just check that the basic functionality is working.
You probably also want to trap when a link within a page would create a new browser window and get that to just create a new tab instead.
-
Jul 20th, 2009, 01:28 PM
#71
Thread Starter
Addicted Member
Re: WebBrowser Tabs
still wont navigate other sites ie google . size is not big and this
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
ActiveBrowser.Stop()
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
End Sub
the highlighted in red goes yellow when deburging
-
Jul 20th, 2009, 01:38 PM
#72
Re: WebBrowser Tabs
the highlighted in red goes yellow when deburging
that sounds like you have a breakpoint on that line rather than an error.
When code isn't running does that line have a solid red background? If so just put your cursor on that line and press F9 to clear it.
-
Jul 20th, 2009, 04:53 PM
#73
Thread Starter
Addicted Member
Re: WebBrowser Tabs
yea it still doesnt wanna navigate other sites and the activebrowser.stop no it dont have a red background has a yellow one sometime it goes off tho
-
Jul 21st, 2009, 02:40 AM
#74
Re: WebBrowser Tabs
OK now you are going to have to be very detailed in specific to explain exactly what is happening.
It still sounds to me like that activebrowser.stop line is a break point not an error, especially as you are not saying there is an error message. When that happens try pressing F5 and see if the program just continues. If it does then it is a breakpoint. To get rid of it, stop your program and open up a code window and press CTRL+SHIFT+F9, and that will clear all breakpoints.
Now secondly when you say "it still doesnt wanna navigate other sites" what do you mean exactly?
If you run your program you should have just the one tab and one webbrowser - right? Don't try and create a 2nd tab yet. What happens if you try to navigate to a site? And how do you do try to launch it? Are you selecting a site from a dropdown, or are you typing the name of a site?
-
Jul 21st, 2009, 07:31 AM
#75
Thread Starter
Addicted Member
Re: WebBrowser Tabs
activewebbrowser it says summit about nullrefrenerece handled and yea i dont open no tabs stick in the url and doesnt wanna navigate to any website i stick in the combobox
-
Jul 21st, 2009, 07:39 AM
#76
Re: WebBrowser Tabs
I said above - you need to be detailed and specific
"summit about nullrefrenerece handled" isn't detailed or specific.
Which line does this error occur on, and what does it say exactly?
-
Jul 21st, 2009, 07:44 AM
#77
Thread Starter
Addicted Member
Re: WebBrowser Tabs
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll
-
Jul 21st, 2009, 07:52 AM
#78
Re: WebBrowser Tabs
OK that isn't a runtime error message in your code.
The reason why it isn't seeming to navigate to your page is this :
Code:
Private Sub WebBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
ComboBox1.Text = ActiveBrowser.Url.ToString()
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).Navigate(ComboBox1.Text)
CType(TabControl1.SelectedTab.Controls(0), WebBrowser).WebBrowserShortcutsEnabled = True
End Sub
This basically is telling the webbrowser to navigate to the page again as soon as it has reached the page, so it is stuck in an endless loop.
I know we've modified this line to work with the ActiveBrowser but it shouldn't have been there in the first place - it will stop the browser from ever loading a page. Delete that line and it will work.
-
Jul 21st, 2009, 07:57 AM
#79
Thread Starter
Addicted Member
Re: WebBrowser Tabs
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
-
Jul 21st, 2009, 07:59 AM
#80
Thread Starter
Addicted Member
Re: WebBrowser Tabs
and i deleted that line still wont navigate
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|