Link to home
Start Free TrialLog in
Avatar of sindbad
sindbad

asked on

Internet Explorer object in VB

Hi,

I'm using Internet Explorer object in a VB app. A URL is passed to the IE object and navigate method is invoked. Now, if for some reason (wrong page, wrong asp, web server is down) the browser object can't load the URL and display the error page, how this can be identifed and checked programmatically ?.

Thanks
Sindbad
Avatar of Ark
Ark
Flag of Russian Federation image

Private Sub WebBrowser1_DownloadComplete()
   If UCase(Left(WebBrowser1.Document.Title, 6)) = "ERROR:" Then MsgBox "An error occure when navigate!", vbCritical, "Error"
End Sub

Cheers
i'm late... again ;)
Avatar of sindbad
sindbad

ASKER


Hi,

Sorry for responding immediately.
I tried your way. But, in each scenario(wrong page, server down, network down) , I get a differnt test in browser.document.title. Is there a way to handle this ?


What's about to store list of possible titles with errors and perform predefined operation for each title?

Cheers
Avatar of sindbad

ASKER


Is there a way to find the status of the .htm/.asp loaded in the browser object (directly in the browser object) than comparing the text in the title of the document representing the loaded page ?.
Avatar of sindbad

ASKER


I'm closing this thread as I don't get a satisfactory
reply.

Avatar of sindbad

ASKER


I'm closing this thread as I didn't get a satisfactory reply.
Don't close it!, post a new 0 points question regarding this one.
Maybe trying this:

Private Sub WebBrowser1_DownloadComplete()
On Error GoTo errTrap
If (pDisp Is WebBrowser1.object) Then
    Me.Caption = WebBrowser1.document.fileSize
End If
Exit Sub
errTrap:
    If Err.Number = -2147467259 Then _
        Me.Caption = "An error ocurred while trying to access that Url."
End Sub
Hi sindbad,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

sindbad, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
Avatar of Netminder
Netminder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial