Solved

mastering  WebBrowser1_DocumentComplete?

Posted on 2004-04-16
9
608 Views
Last Modified: 2008-03-03
Just wondering if I can tweek this code...
It works ok when running it live, but when I 'Step Into' during Debuggin, I get stuck in the loop...
I guess I would like to know why the DocumentComplete Event is not fired [or stepped into] during debuging?


Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    pagefinished = 1
End Sub

Private Sub LetsGo()
    pagefinished = 0
    Call WebBrowser1.Navigate(sItem.href)
    Do While pagefinished = 0: DoEvents: Loop
End Sub


p.s. Gin Martinis are better than Vodka?...its friday!!! Cheers
0
Comment
Question by:williamsF1
  • 3
  • 2
9 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 25 total points
ID: 10846965
That kind of event cannot be "step into". You can only place a breakpoint after the Loop.
0
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 10847772
Instead of using a variable to flag when the document is complete, you could possible just check if the document is set or not which *should* work the same. Not completely sure though.

Private Sub Command1_Click()
    Call WebBrowser1.Navigate("http://www.yahoo.com")
    Do Until TypeName(WebBrowser1.Document) <> "Nothing"
        DoEvents
    Loop
    Call MsgBox("Finished downloading.")
End Sub
0
 

Author Comment

by:williamsF1
ID: 10853416
zzzzooc, this doesnt actuall wait for the document to be finished.
I try to set focus on an object and it fails as it hasn't been loaded yet. Sorry.

So I guess there is no other solution. Emoreau, you 100% sure on that?

0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 69

Expert Comment

by:Éric Moreau
ID: 10853420
Yes that kind of events can't be traced.
0
 
LVL 17

Assisted Solution

by:zzzzzooc
zzzzzooc earned 25 total points
ID: 10853472
Possibly.

You could always just check the state of the WebBrowser.

Private Sub Form_Load()
    Me.Visible = True
    Call WebBrowser1.Navigate("http://www.downloads.com")
    Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
        DoEvents
    Loop
    Call MsgBox("Finished downloading.")
End Sub

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/enums/readystate_enum.asp

0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 11255818
points to emoreau
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to the message 13 63
Extract Data and filename Macro 20 98
VB 6.0 printer how to align 6 49
Adding to a VBA? 6 46
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now