Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to error check Inet1.OpenURL?

Status
Not open for further replies.

davidck88

Programmer
Jan 5, 2009
27
NL
I'm using the MS Internet Transfer Control to connect to a remote web server and download a small amount of text( a few lines of text.) and use it as content of one of my massagebox and its cpation text. Since this server will be serving multiple clients some time inet might fail to get the data for whatever reasons such as timeout,site down,busy server,no connection to internet, .... so if any one of these unwanted cases happens I want show the user a default massagebox (msgbox "try again"). But i don't know how i can detect those cases that make inet fail to get the text data so i be happy if an expert show me how this can done.Thanks

Code:
Private Sub Timer1_Timer()
    If ProgressBar1.Value < ProgressBar1.Max Then
        ProgressBar1.Value = ProgressBar1.Value + 1
    Else
        Timer1.Enabled = False
        
        Dim massagbox2 As String
        Dim massagebox2Caption As String
        
massagbox2 = Inet1.OpenURL("[URL unfurl="true"]http://www.somesite.com/demo/text.txt")[/URL]
        massagebox2Caption = Inet1.OpenURL("[URL unfurl="true"]http://www.somesite.com/demo/caption.txt")[/URL]
        
MsgBox massagbox2, , massagebox2Caption

''' here some how i want to add a deafult massagebox if inet above fails for any reason
        Unload Me
        Form1.Show
    End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top