Leaders dynamic_sysop Posted July 15, 2003 Leaders Posted July 15, 2003 (edited) Not sure if this will be classed as Ok for the Code section , but here ya go . I've noticed on a few boards that people have been asking about the " BeforeNavigate2 " event not triggering when using the AxWebBrowser control , so i decided to tackle the problem and here's the result : Private WithEvents doc As SHDocVw.DWebBrowserEvents_Event '/// doc will handle all the events for brWeb now... Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim b As Object = brWeb.Application doc = DirectCast(b, SHDocVw.WebBrowser_V1) '///set doc as the active handler for brWeb's events. End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click brWeb.Navigate("http://google.com") '///lets navigate to a website. End Sub Private Sub doc_BeforeNavigate(ByVal URL As String, ByVal Flags As Integer, ByVal TargetFrameName As String, ByRef PostData As Object, ByVal Headers As String, ByRef Cancel As Boolean) Handles doc.BeforeNavigate MessageBox.Show(URL) '/// check that before navigate now works. End Sub Private Sub doc_StatusTextChange(ByVal [Text] As String) Handles doc.StatusTextChange Label1.Text = Text '///show the status text in a label. End Sub Private Sub doc_TitleChange(ByVal [Text] As String) Handles doc.TitleChange MyBase.Text = Text '/// set the form's caption to the current url End Sub it may help a few people atleast :)webbrowser.zip Edited May 4, 2007 by PlausiblyDamp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.