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):
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.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




Reply With Quote