Results 1 to 3 of 3

Thread: If webbrowser.url = "..." then ??, and is it possible to retrieve data from web page?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    80

    If webbrowser.url = "..." then ??, and is it possible to retrieve data from web page?

    Hi,

    I wanted to create an event that when I hit a button, it will check if the webbrower has reached THISPAGE.html.

    Code:
    If webbrower1.Url.toString = "thispage.html" then    'this line may have been webbrowser.Url.toString("thispage.html") cant remember I tried both ways neither worked.
    
     do something
    
    End If
    But i get a null exception error.

    Is there a way to do this?

    My other question is , is it possible to pull data or text from a website like through the webbrowser control thing and place it inside a textbox or label or something like that?

    thx all help is much appreciated

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: If webbrowser.url = "..." then ??, and is it possible to retrieve data from web p

    Well first things first, that is not an event, that is just an If statement. Second, have you checked if the WebBrowser is actually instantiated and that the Url property has something assigned?

    Also the WebClient class provides methods to download a string or file if that's what you are wanting, as an example:

    vb.net Code:
    1. Using wc As New Net.WebClient()
    2.     Me.MyTextBoxToShowString.Text = wc.DownloadString("http://www.vbforums.com/showthread.php?t=580697")
    3. End Using

  3. #3
    Frenzied Member stateofidleness's Avatar
    Join Date
    Jan 2009
    Posts
    1,780

    Re: If webbrowser.url = "..." then ??, and is it possible to retrieve data from web p

    like FA said, you would need to put that If statement inside of a button's click event.

    you might even just put it in the documentCompleted event of the web browser, but that is assuming a bit much. you could enable the button in the documentcompleted event, that way you know it has loaded the URL completely and when you click the button, it will have something to test against.

    you said "neither worked." Was there an error, or just bad results? what were the results?

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