Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WebBrowser Object Help, Insert Form Help

Status
Not open for further replies.

lfast

IS-IT--Management
Apr 16, 2002
16
0
0
US
Hi,
I have two really simple questions.. I am very new to
programming in VB6 ... So my questions, are very basic.

1. I've built a browser using the web browser object --
I need to be able to BROWSE TO THE END of my http link
list ... that is I have a bunch of links that I need to
be able to open...
I've tried the syntax:
for index=1 to number_of_links
txtURL.Text = link(index)
WebBrowser1.Navigate (txtURL.Text)
next index

But this only takes me to the last page.. when I hit
my back button -- which is run with WebBrowser1.GoBack
it goes back to the first page ... not the first to last page , next to first to last, etc ...

2. I have two forms. When I hit my button which goes to
the other form. It works most of the time.. but not all.
The form is called frmParser. So I say
frmParser.show (modal) or just frmParser.show
which doesn't always work.. I might need to refresh...

ANY HELP?!?!?

Thank you,

David
 

You have to wait for each page to load (not entirely but enough to be recognized in the history list but best to let it load).

Here is a repost of code from an earlier thread
[tt]
Option Explicit

Dim Wait As Boolean, Good As Boolean

Private Sub Command1_Click()

Wait = False
Good = False
WB.Navigate Text1.Text

Do While Wait = False
Doevents
Loop

If Good = True Then Debug.Print WB.Document.body.innerText

End Sub

Private Sub WB_DocumentComplete(ByVal pDisp As Object, URL As Variant)

On Error GoTo WB_DocumentCompleteError

If (Trim(URL) <> &quot;&quot;) And (InStr(1, URL, Text1.Text) > 0) Then Wait = True

Exit Sub
WB_DocumentCompleteError:

MsgBox Err.Description

End Sub

Private Sub WB_TitleChange(ByVal Text As String)

On Error GoTo WB_TitleChangeError

If UCase(Trim(Text)) <> UCase(Trim(&quot;Cannot find server&quot;)) Then Good = True

Exit Sub
WB_TitleChangeError:

MsgBox Err.Description

End Sub
[/tt]

This is not quite complete (close) but it should get well on your way.

Good Luck

 
vb5,
Just writing to say thank you.. I will try that,.. and also peruse the responses already written in the future...
They you for your prompt response!

-- David Brook
 
Ended up with something a bit shorter.. which doesn't work quite right... -- seems to work partially, then I have to get it to continue by refreshing the screen... HMMMM...

WebBrowser1.Navigate (txtURL.Text)
Do
DoEvents
Loop Until WebBrowser1.Busy = False

That's a little shorter.. I could not figure out some of the code above.. such as WB.Document.body.innerText . .

Hope this helps others too..

-- David
 

That just returns the body of the html document (not the html code).

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top