Results 1 to 4 of 4

Thread: WebBrowser Retrieve link [VB2008]

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    7

    WebBrowser Retrieve link [VB2008]

    Is it possible to retrieve the link that user clicked on the WebBrowser Control

  2. #2
    Addicted Member sauronsmatrix's Avatar
    Join Date
    Jun 2008
    Location
    USA
    Posts
    133

    Re: WebBrowser Retrieve link [VB2008]

    Use the "Navigating event"

    ex:
    Code:
        Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
            somestring = e.Url
        End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    7

    Re: WebBrowser Retrieve link [VB2008]

    vb Code:
    1. Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
    2.         somestring = e.Url
    3.     End Sub

    when the browser gets _blank returned, it seems to have no effect

  4. #4
    Hyperactive Member
    Join Date
    Jun 2008
    Location
    Nowhere
    Posts
    427

    Re: WebBrowser Retrieve link [VB2008]

    It not supposed to. What is it supposed to tell you when theres nothing to go to? It only shows when ur navigating and the page your navigation to and from, take what i used here for an example:

    vb Code:
    1. Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
    2.         Label2.Text = "Transferring data from " & WebBrowser1.Url.ToString & " ( Port:" & WebBrowser1.Url.Port & " )"
    3.     End Sub

    If i go to google it shows transferring data from google.com and if i go to a next page it shows transferring data from google then transferring data from the site im going to.
    "Programming is like sex. One mistake and you have to support it for the rest of your life." ~Michael Sinz


    Code Snippets/Usefull Links:
    WinRAR DLL|Vista Style Form|Krypton Component Library|Windows Form Aero|Parsing XML files|Calculate File's CRC 32|Download a list of files.

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