Results 1 to 7 of 7

Thread: Ie Control

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    4

    Ie Control

    in vb5 how do I copy line 1006 from a web page into a text box using the internet explorer control
    Last edited by Yahweh; Aug 30th, 2012 at 03:33 PM.

  2. #2
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,844

    Re: Ie Control

    line 1006 ? from source code? how are you getting source code? document.body.outerhtml?
    or do you mean line 1006 of the Internet Explorer Menu (View - Source) Line 1006?
    i dont know how to get 1006 line of IE Source because IE have its own Html "Source" Viewer but if you know what you are looking for its easier to get. if not you would have to get the text from IE Source Viewer's textbox will require API Calls

    if you get code with inet its close but not exactly the same ...

  3. #3
    New Member
    Join Date
    Aug 12
    Posts
    4

    Re: Ie Control

    1006 is just a random number
    if i cant get it directly from the control how do i get the 1006th line of text7.text into text 1

    InternetExploiter.Navigate "http://www.youtube.com/"
    Dim sText As String, sTextHTML As String
    Dim SleepS
    sT = InternetExploiter.Document.body.innerText
    sTextHTML = InternetExploiter.Document.documentElement.outerHTML
    Text7.Text = sTextHTML


    this is to extract certain lines of text from web pages i can convert pages for old browsers like cello
    i want to take the info from sites and have a semi automatic conversion
    i would have to update this each re desighn

  4. #4
    Frenzied Member
    Join Date
    Jan 09
    Location
    Watch Window(Shift+f9)
    Posts
    1,431

    Re: Ie Control

    please always post code inside code tags. it is much better more readable
    Code:
    InternetExploiter.Navigate "http://www.youtube.com/"
    Dim sText As String, sTextHTML As String
    Dim SleepS
    sT = InternetExploiter.Document.body.innerText
    sTextHTML = InternetExploiter.Document.documentElement.outerHTML
    Text7.Text = sTextHTML

  5. #5
    New Member
    Join Date
    Aug 12
    Posts
    4

    Re: Ie Control

    Quote Originally Posted by firoz.raj View Post
    please always post code inside code tags. it is much better more readable
    Code:
    InternetExploiter.Navigate "http://www.youtube.com/"
    Dim sText As String, sTextHTML As String
    Dim SleepS
    sT = InternetExploiter.Document.body.innerText
    sTextHTML = InternetExploiter.Document.documentElement.outerHTML
    Text7.Text = sTextHTML
    Thank you
    Code:
    but it still doesn't answer my question
    if anyone has a solution to my problem please help
    it will be greatly appreciated

  6. #6
    New Member
    Join Date
    Aug 12
    Posts
    4

    Re: Ie Control

    Quote Originally Posted by firoz.raj View Post
    please always post code inside code tags. it is much better more readable
    Code:
    InternetExploiter.Navigate "http://www.youtube.com/"
    Dim sText As String, sTextHTML As String
    Dim SleepS
    sT = InternetExploiter.Document.body.innerText
    sTextHTML = InternetExploiter.Document.documentElement.outerHTML
    Text7.Text = sTextHTML
    Thank you
    Code:
    but it still doesn't answer my question
    if anyone has a solution to my problem please help
    it will be greatly appreciated

  7. #7
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,844

    Re: Ie Control

    what is so interesting about line 1006? what are you trying to get out of it?

    you can use a function like this (when it is split with vbnewline)

    Code:
    Private Function ExtractLine(LineNumber As Integer, TextString) As String
    
    On Error GoTo ErrHandler
    
      Dim SPT() As String 'Split Text
        
        'When you split your array will start with 0. but in our language 0 is not a line 1 would be the first line not 0.
        'so i will substract 1 number from Line_Number to be the exact match
        
        SPT = Split(TextString, vbNewLine)
        MsgBox UBound(SPT)
        ExtractLine = SPT(LineNumber - 1)
      Exit Function
      
    ErrHandler:
      MsgBox "Invalid Line Number.", vbInformation, "Error while Extracting Text"
    End Function
    Get line text like this

    Code:
    MsgBox ExtractLine(1,Text1.Text)
    but in this case the string is all one line for some reason.. well when i use your code there is no vbNewLine split

    i'm not sure exactly what you want to do but you might have to get object by object from the document... or go by TAG / ID / ELEMENT name

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •