Solved

mastering  WebBrowser1_DocumentComplete?

Posted on 2004-04-16
9
636 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
9 Comments
 
LVL 70

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 70

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 70

Expert Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

724 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