Solved

Continue after an error

Posted on 2012-04-02
6
251 Views
Last Modified: 2012-04-06
I have the following code in vb6 to check the current version of my software before it opens.

cData = Inet1.OpenURL("http://www.mywebsite.org/version.txt", 0)

The problem is that sometimes www.mywebsite.org is sometimes down and I don't want the program to get hung up on trying to locate an unreachable file.

When I recieve an error on the above site, what can I do to make the program continue
0
Comment
Question by:al4629740
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 250 total points
ID: 37799332
on error resume next
0
 
LVL 17

Assisted Solution

by:vb_elmar
vb_elmar earned 250 total points
ID: 37799414
You can constantly check the State of the Inet1 control using a timer.
Here is a small code sample.
2.zip
0
 

Author Comment

by:al4629740
ID: 37799424
How about this?

If InternetCheckConnection("http://www.mywebsite.org/", &H1, 0) = 1 Then

'Code goes here

end if
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:al4629740
ID: 37799427
i would declare

Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias _
"InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long, _
ByVal dwReserved As Long) As Long
0
 
LVL 17

Expert Comment

by:vb_elmar
ID: 37799759
InternetCheckConnection allows to check if a connection to
"http://www.mywebsite.org/" can be established.

It is not capable to check if the file "version.txt" on the web page "http://www.mywebsite.org/" exists.
0
 
LVL 17

Expert Comment

by:vb_elmar
ID: 37801048
To check if "www.mywebsite.org" is down and the file "version.txt" is reachable or unreachable
I recommend the "URLDownloadToFile" API. -See the attached code sample.
5.zip
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to the message 13 63
VB error "Type mismatch" 2 43
message box in access 4 34
Visual Studio 2005 text editor 10 23
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

11 Experts available now in Live!

Get 1:1 Help Now