Solved

mastering  WebBrowser1_DocumentComplete?

Posted on 2004-04-16
9
615 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 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

18 Experts available now in Live!

Get 1:1 Help Now