Results 1 to 7 of 7

Thread: Webbrowser.Sourcecode reading + gathering text(+finding)(code) + dropping in txtbox

Threaded View

  1. #3
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    281

    Re: Webbrowser.Sourcecode reading + gathering text(+finding)(code) + dropping in txtb

    this may help get the ball rolling..have you tried
    Code:
    Dim strAuthorCode As String = sender.Document.Body.InnerText
    
    or if you want to save it to a text file
    
    Dim HtmlFile = "C:\whatever.txt"
    Dim HTMlAuthorCode As String = sender.DocumentText
    My.Computer.FileSystem.WriteAllText(HtmlFile, HTMlAuthorCode, False)
    either way once you have the source code you can use instr to locate the line or starting text you want then locate something after the text you want then hone in on the part you want..and this part is probably not the best solution but it should work. Once you have the Source that is.
    Code:
    Dim UrlStart As Integer = InStr(HtmlFile, "<a href="/url?q=")
    Dim UrlEnd As Integer = InStr(UrlStart , HtmlFile, "</A>")
    Dim UrlLink = Mid(HtmlFile, UrlStart + 21, UrlEnd - UrlStart - 26) <-----you'll have to change these numbers to hone in on the exact part you want
    This is just an example you can mess with it until you find something else?

    these would go in the webbrowser1_completed sub
    Last edited by M@dH@tter; Dec 23rd, 2012 at 08:37 AM.

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