Home All Groups Group Topic Archive Search About

How to confirm a Web Page Download is Complete?

Author
15 Dec 2006 8:18 AM
Sean
I know there has been a lot of questions and answers on this topic, But
I still don't have a clear understanding of how this works in VB6. So
here is what I did to really make sure that the webpage has been
downloaded completely before my program proceeds to click the order
entry confirmation button. But from time to time, when there are many
order entry transations, the dreadful run time error message "Object or
structure not found" shows up and crash my program.

'first checking
'==========
Web3Ready = False
strWaiting = "Web3"
Do While Not Web3Ready '
    DoEvents
Loop

'second checking
'=============
Do While Form1.WebBrowser3.Busy
        DoEvents
Loop


'third checking
'==========
If IsObject(Form1.WebBrowser3.Document.All.Item("OrderEntry1:_ctl13"))
Then
Form1.WebBrowser3.Document.All.Item("OrderEntry1:_ctl13").Click
End If

Author
16 Dec 2006 12:26 PM
Cor Ligthert [MVP]
Sean,

Is this for Net 2.0 using the webbrowser from that or is it the
Axwebbrowser, for the last you can use the downloadcomplete2 event.

For the first has Herfried written a nice solution in this newsgroup,
\\\
Private Sub WebBrowser1_DocumentCompleted( _
    ByVal sender As Object, _
    ByVal e As WebBrowserDocumentCompletedEventArgs _
) Handles WebBrowser1.DocumentCompleted
    If Me.WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
        MsgBox("Document and frames loaded!")
    End If
End Sub
///

I hope this helps,

Cor


Show quoteHide quote
"Sean" <yee***@gmail.com> schreef in bericht
news:1166170680.855450.280270@16g2000cwy.googlegroups.com...
>I know there has been a lot of questions and answers on this topic, But
> I still don't have a clear understanding of how this works in VB6. So
> here is what I did to really make sure that the webpage has been
> downloaded completely before my program proceeds to click the order
> entry confirmation button. But from time to time, when there are many
> order entry transations, the dreadful run time error message "Object or
> structure not found" shows up and crash my program.
>
> 'first checking
> '==========
> Web3Ready = False
> strWaiting = "Web3"
> Do While Not Web3Ready '
>    DoEvents
> Loop
>
> 'second checking
> '=============
> Do While Form1.WebBrowser3.Busy
>        DoEvents
> Loop
>
>
> 'third checking
> '==========
> If IsObject(Form1.WebBrowser3.Document.All.Item("OrderEntry1:_ctl13"))
> Then
> Form1.WebBrowser3.Document.All.Item("OrderEntry1:_ctl13").Click
> End If
>
Author
17 Dec 2006 7:54 AM
Sean
Hi Cor,

Thanks for the posting and your kind advice.

My environment is neither Net2.0 nor Axwebbrowser, but simple VB6.0 in
Microsoft visual studio 6.0. I am not sure whether I can still use your
quoted solution, but will try in my environment.

Thanks again.

Sean

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Sean,
>
> Is this for Net 2.0 using the webbrowser from that or is it the
> Axwebbrowser, for the last you can use the downloadcomplete2 event.
>
> For the first has Herfried written a nice solution in this newsgroup,
> \\\
> Private Sub WebBrowser1_DocumentCompleted( _
>     ByVal sender As Object, _
>     ByVal e As WebBrowserDocumentCompletedEventArgs _
> ) Handles WebBrowser1.DocumentCompleted
>     If Me.WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
>         MsgBox("Document and frames loaded!")
>     End If
> End Sub
> ///
>
> I hope this helps,
>
> Cor
>
>
> "Sean" <yee***@gmail.com> schreef in bericht
> news:1166170680.855450.280270@16g2000cwy.googlegroups.com...
> >I know there has been a lot of questions and answers on this topic, But
> > I still don't have a clear understanding of how this works in VB6. So
> > here is what I did to really make sure that the webpage has been
> > downloaded completely before my program proceeds to click the order
> > entry confirmation button. But from time to time, when there are many
> > order entry transations, the dreadful run time error message "Object or
> > structure not found" shows up and crash my program.
> >
> > 'first checking
> > '==========
> > Web3Ready = False
> > strWaiting = "Web3"
> > Do While Not Web3Ready '
> >    DoEvents
> > Loop
> >
> > 'second checking
> > '=============
> > Do While Form1.WebBrowser3.Busy
> >        DoEvents
> > Loop
> >
> >
> > 'third checking
> > '==========
> > If IsObject(Form1.WebBrowser3.Document.All.Item("OrderEntry1:_ctl13"))
> > Then
> > Form1.WebBrowser3.Document.All.Item("OrderEntry1:_ctl13").Click
> > End If
> >