Results 1 to 3 of 3

Thread: [RESOLVED] Changing the address of webbrowser

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Resolved [RESOLVED] Changing the address of webbrowser

    Hi all,

    How can I change the address of the WebBrowser control from the first url to another one inside sub such as (My full program so u can understand):

    Code:
    Option Explicit
    
    Private Sub cmd_info_Click()
    
    Dim string1 As String
    Dim string2 As String
    Dim links As Integer
    Dim i As Integer
    
    '--------------------------------------------------------
    
    string1 = WebBrowser1.Document.Body.InnerText
    string1 = Replace(string1, Chr$(13), Chr$(32))
    string1 = Replace(string1, Chr$(10), Chr$(32))
        
    For i = 0 To 100
        string1 = Replace(string1, "  ", " ")
    Next i
    
    string1 = Trim(string1)
    
    '--------------------------------------------------------
    
    links = 10
    
    On Error Resume Next
    
    For i = 0 To links
        If string2 = "" Then
            string2 = WebBrowser1.Document.links(i).href
        Else
            string2 = string2 & " " & WebBrowser1.Document.links(i).href
        End If
    Next i
    
    '--------------------------------------------------------
    
    txt_page.Text = string1
    
    txt_links.Text = string2
    
    '--------------------------------------------------------
    
    Dim TempArray1
    Dim TempString1 As String
    Dim url As String
    Dim v As Integer
    
    TempArray1 = Split(string2, " ", -1, vbTextCompare)
    
    For i = 0 To UBound(TempArray1)
    
        url = TempArray1(i)
    
        WebBrowser1.Navigate (url)
        
        TempString1 = WebBrowser1.Document.Body.InnerText
        TempString1 = Replace(TempString1, Chr$(13), Chr$(32))
        TempString1 = Replace(TempString1, Chr$(10), Chr$(32))
        
        For v = 0 To 100
            TempString1 = Replace(TempString1, "  ", " ")
        Next v
    
        TempString1 = Trim(TempString1)
        
        txt_sub.Text = TempString1
    Next i
    
    End Sub
    
    Private Sub cmd_open_Click()
    
    WebBrowser1.Navigate ("http://www.zeid1.com")
    
    End Sub
    This in BOLD is not working with me .. I need to do something like a small spider That starts from a page then get links from inside the data of the first page and open them.

  2. #2
    Fanatic Member Mxjerrett's Avatar
    Join Date
    Apr 2006
    Location
    Oklahoma
    Posts
    939

    Re: Changing the address of webbrowser

    If you are using a combo box put something like this in WebBrowser_ProgressChange

    Combo1.Text = WebBrowser1.LocationURL

    If a post has been helpful please rate it.
    If your question has been answered, pull down the tread tools and mark it as resolved.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Re: Changing the address of webbrowser

    thx, but nevermind found the problem

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